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
0efabc3f
Unverified
Commit
0efabc3f
authored
Aug 13, 2016
by
Thom Wiggers
📐
Browse files
Convert registration required to a function
parent
a64f7375
Changes
2
Hide whitespace changes
Inline
Side-by-side
website/events/migrations/0003_remove_event_registration_required.py
0 → 100644
View file @
0efabc3f
# -*- coding: utf-8 -*-
# Generated by Django 1.10 on 2016-08-13 14:21
from
__future__
import
unicode_literals
from
django.db
import
migrations
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'events'
,
'0002_auto_20160813_1620'
),
]
operations
=
[
migrations
.
RemoveField
(
model_name
=
'event'
,
name
=
'registration_required'
,
),
]
website/events/models.py
View file @
0efabc3f
...
...
@@ -25,11 +25,6 @@ class Event(models.Model):
null
=
True
,
)
registration_required
=
models
.
BooleanField
(
_
(
'registration required'
),
default
=
False
)
registration_start
=
models
.
DateTimeField
(
_
(
"registration start"
),
null
=
True
,
...
...
@@ -84,13 +79,16 @@ class Event(models.Model):
published
=
models
.
BooleanField
(
_
(
"published"
),
default
=
False
)
def
registration_required
(
self
):
return
bool
(
self
.
registration_start
)
or
bool
(
self
.
registration_end
)
def
clean
(
self
):
super
().
clean
()
errors
=
{}
if
self
.
end
<
self
.
start
:
errors
.
update
({
'end'
:
_
(
"Can't have an event travel back in time"
)})
if
self
.
registration_required
:
if
self
.
registration_required
()
:
if
self
.
no_registration_message
:
errors
.
update
(
{
'no_registration_message'
:
_
(
...
...
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