Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
thalia
concrexit
Commits
dcc7f19c
Commit
dcc7f19c
authored
Jan 09, 2019
by
Luko van der Maas
Browse files
fixed send_notifcation and admin
parent
390db682
Changes
3
Hide whitespace changes
Inline
Side-by-side
website/events/admin.py
View file @
dcc7f19c
...
...
@@ -72,6 +72,7 @@ class RegistrationInformationFieldInline(admin.StackedInline):
class
PizzaEventInline
(
admin
.
StackedInline
):
"""The inline for pizza events in the Event admin"""
model
=
PizzaEvent
exclude
=
(
'end_reminder'
,)
extra
=
0
max_num
=
1
...
...
website/pizzas/admin.py
View file @
dcc7f19c
...
...
@@ -17,6 +17,7 @@ class ProductAdmin(admin.ModelAdmin):
@
admin
.
register
(
PizzaEvent
)
class
PizzaEventAdmin
(
admin
.
ModelAdmin
):
list_display
=
(
'title'
,
'orders'
)
exclude
=
(
'end_reminder'
,)
def
orders
(
self
,
obj
):
return
format_html
(
_
(
'<strong><a href="{link}">Orders</a></strong>'
),
...
...
website/pizzas/models.py
View file @
dcc7f19c
...
...
@@ -65,6 +65,7 @@ class PizzaEvent(models.Model):
def
__init__
(
self
,
*
args
,
**
kwargs
):
super
().
__init__
(
*
args
,
**
kwargs
)
self
.
_end
=
self
.
end
self
.
_send_notification
=
self
.
send_notification
def
validate_unique
(
self
,
exclude
=
None
):
super
().
validate_unique
(
exclude
)
...
...
@@ -88,7 +89,9 @@ class PizzaEvent(models.Model):
})
def
save
(
self
,
*
args
,
**
kwargs
):
if
not
self
.
end_reminder
:
if
((
not
self
.
end_reminder
or
(
not
self
.
_send_notification
and
self
.
send_notification
))
and
self
.
send_notification
):
end_reminder
=
ScheduledMessage
()
end_reminder
.
title_en
=
'Order pizza'
end_reminder
.
title_nl
=
'Pizza bestellen'
...
...
@@ -105,10 +108,13 @@ class PizzaEvent(models.Model):
self
.
end_reminder
=
end_reminder
if
self
.
_end
!=
self
.
end
:
if
self
.
_end
!=
self
.
end
and
self
.
send_notification
:
self
.
end_reminder
.
time
=
self
.
end
self
.
end_reminder
.
save
()
if
self
.
_send_notification
and
not
self
.
send_notification
:
self
.
end_reminder
.
delete
()
super
().
save
(
*
args
,
**
kwargs
)
def
__str__
(
self
):
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment