Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
steering
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
AURA
steering
Commits
ffdd7459
Verified
Commit
ffdd7459
authored
1 year ago
by
Ernesto Rico Schmidt
Browse files
Options
Downloads
Plain Diff
Merge branch 'main' into develop
parents
5a9923d9
28ef3bfc
No related branches found
No related tags found
1 merge request
!29
Use docker main tag
Pipeline
#7038
passed
1 year ago
Stage: build
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
program/models.py
+15
-0
15 additions, 0 deletions
program/models.py
with
15 additions
and
0 deletions
program/models.py
+
15
−
0
View file @
ffdd7459
...
...
@@ -26,6 +26,7 @@ from versatileimagefield.fields import PPOIField, VersatileImageField
from
django.contrib.auth.models
import
User
from
django.db
import
models
from
django.db.models
import
Q
,
QuerySet
from
django.utils
import
timezone
from
django.utils.translation
import
gettext_lazy
as
_
from
program.utils
import
parse_datetime
from
steering.settings
import
THUMBNAIL_SIZES
...
...
@@ -248,6 +249,20 @@ class Show(models.Model):
def
__str__
(
self
):
return
self
.
name
def
save
(
self
,
*
args
,
**
kwargs
):
now
=
timezone
.
datetime
.
now
()
today
=
now
.
date
()
if
self
.
pk
and
self
.
is_active
is
False
:
# deactivating a show means:
# - **delete all* the timeslots that belong to a schedule of this show the after now
# - **update all** the schedules of this show have today as `last_date`
TimeSlot
.
objects
.
filter
(
schedule__show
=
self
,
start__gt
=
now
).
delete
()
self
.
schedules
.
filter
(
Q
(
last_date__gt
=
today
)
|
Q
(
last_date
=
None
)).
update
(
last_date
=
today
)
super
().
save
(
*
args
,
**
kwargs
)
class
ShowLink
(
Link
):
show
=
models
.
ForeignKey
(
Show
,
on_delete
=
models
.
CASCADE
,
related_name
=
"
links
"
)
...
...
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