Unverified Commit 0efabc3f authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Convert registration required to a function

parent a64f7375
# -*- 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',
),
]
......@@ -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': _(
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment