Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Maják
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TO
Maják
Commits
e7bac6e4
Commit
e7bac6e4
authored
2 years ago
by
quido.zientek
Browse files
Options
Downloads
Plain Diff
Merge branch 'feature/pirati-cz' into feature/pirati-cz-quidecek
parents
07102aee
6702fee4
No related branches found
No related tags found
3 merge requests
!607
Pirati.cz
,
!598
Feature/pirati cz quidecek
,
!575
Feature/pirati cz
Pipeline
#9546
passed
2 years ago
Stage: build
Changes
21
Pipelines
2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
shared/utils.py
+11
-0
11 additions, 0 deletions
shared/utils.py
with
11 additions
and
0 deletions
shared/utils.py
+
11
−
0
View file @
e7bac6e4
import
json
import
logging
import
urllib.request
import
bleach
import
requests
from
django.conf
import
settings
from
django.core.files
import
File
from
django.utils.translation
import
gettext_lazy
from
wagtail.admin.edit_handlers
import
(
CommentPanel
,
...
...
@@ -13,12 +15,21 @@ from wagtail.admin.edit_handlers import (
)
from
wagtail.core.models
import
Page
from
wagtail.images.edit_handlers
import
FieldPanel
from
wagtail.images.models
import
Image
from
tuning
import
admin_help
logger
=
logging
.
getLogger
()
def
create_image_from_url
(
url
,
filename
):
img_data
=
urllib
.
request
.
urlretrieve
(
url
)
img_obj
=
Image
(
title
=
filename
)
img_obj
.
file
.
save
(
filename
,
File
(
open
(
img_data
[
0
],
"
rb
"
)))
img_obj
.
save
()
return
img_obj
def
get_subpage_url
(
page
,
dest_page_type
):
try
:
return
page
.
get_descendants
().
type
(
dest_page_type
).
live
().
first
().
get_url
()
...
...
This diff is collapsed.
Click to expand it.
Prev
1
2
Next
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment