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
68871102
Commit
68871102
authored
2 years ago
by
Tomáš Valenta
Committed by
jan.bednarik
1 year ago
Browse files
Options
Downloads
Patches
Plain Diff
sync styleguide2 changes
parent
9c5f2e63
Branches
Branches containing commit
No related tags found
2 merge requests
!804
Release
,
!782
Improve personal calendar styling, view more info, sync Instagram on save
Pipeline
#13674
passed
1 year ago
Stage: build
Changes
4
Pipelines
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
calendar_utils/models.py
+0
-2
0 additions, 2 deletions
calendar_utils/models.py
instagram_utils/models.py
+26
-0
26 additions, 0 deletions
instagram_utils/models.py
main/models.py
+7
-2
7 additions, 2 deletions
main/models.py
main/static/main/main.js
+1
-1
1 addition, 1 deletion
main/static/main/main.js
with
34 additions
and
5 deletions
calendar_utils/models.py
+
0
−
2
View file @
68871102
...
...
@@ -117,8 +117,6 @@ class CalendarMixin(models.Model):
if
event
[
"
description
"
]
not
in
(
""
,
None
):
parsed_event
[
"
description
"
]
=
event
[
"
description
"
]
print
(
event
)
calendar_format_events
.
append
(
parsed_event
)
return
json
.
dumps
(
calendar_format_events
)
...
...
This diff is collapsed.
Click to expand it.
instagram_utils/models.py
+
26
−
0
View file @
68871102
...
...
@@ -2,6 +2,7 @@ import datetime
import
mimetypes
import
uuid
from
django.conf
import
settings
from
django.db
import
models
...
...
@@ -74,3 +75,28 @@ class InstagramPost(models.Model):
class
Meta
:
ordering
=
(
"
timestamp
"
,)
class
InstagramMixin
(
models
.
Model
):
def
save
(
self
,
*
args
,
**
kwargs
):
"""
Update Instagram posts when saved, assume they are declared
"""
from
.services
import
InstagramDownloadService
try
:
service
=
InstagramDownloadService
(
app_id
=
settings
.
INSTAGRAM_APP_ID
,
app_secret
=
settings
.
INSTAGRAM_APP_SECRET
,
)
service
.
perform_update
()
except
Exception
:
logger
.
error
(
"
Instagram post update failed
"
,
exc_info
=
True
)
super
().
save
(
*
args
,
**
kwargs
)
class
Meta
:
abstract
=
True
This diff is collapsed.
Click to expand it.
main/models.py
+
7
−
2
View file @
68871102
...
...
@@ -31,7 +31,7 @@ from wagtailmetadata.models import MetadataPageMixin
from
calendar_utils.models
import
CalendarMixin
from
elections2021.constants
import
REGION_CHOICES
# pozor, import ze sousedního modulu
from
instagram_utils.models
import
InstagramPost
from
instagram_utils.models
import
InstagramPost
,
InstagramMixin
from
shared.forms
import
SubscribeForm
from
shared.models
import
(
# MenuMixin,
ArticleMixin
,
...
...
@@ -54,7 +54,12 @@ class ARTICLE_TYPES(models.IntegerChoices):
class
MainHomePage
(
MenuMixin
,
RoutablePageMixin
,
ExtendedMetadataHomePageMixin
,
MetadataPageMixin
,
Page
MenuMixin
,
RoutablePageMixin
,
ExtendedMetadataHomePageMixin
,
MetadataPageMixin
,
InstagramMixin
,
Page
):
# header
...
...
This diff is collapsed.
Click to expand it.
main/static/main/main.js
+
1
−
1
View file @
68871102
This diff is collapsed.
Click to expand it.
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