Verified Commit f195f7bf authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Fix migration containing datetime

parent 867f9dfc
# Generated by Django 2.0.1 on 2018-01-12 11:14
from django.db import migrations, models
import django.db.models.deletion
import events.models
class Migration(migrations.Migration):
dependencies = [
('events', '0024_auto_20180111_1039'),
]
operations = [
migrations.AlterField(
model_name='registration',
name='member',
field=models.ForeignKey(blank=True, limit_choices_to=events.models.registration_member_choices_limit, null=True, on_delete=django.db.models.deletion.CASCADE, to='members.Member'),
),
]
...@@ -258,6 +258,11 @@ class Event(models.Model, metaclass=ModelTranslateMeta): ...@@ -258,6 +258,11 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
) )
def registration_member_choices_limit():
return (Q(membership__until__isnull=True) |
Q(membership__until__gt=timezone.now().date()))
class Registration(models.Model): class Registration(models.Model):
"""Event registrations""" """Event registrations"""
...@@ -276,8 +281,7 @@ class Registration(models.Model): ...@@ -276,8 +281,7 @@ class Registration(models.Model):
'members.Member', models.CASCADE, 'members.Member', models.CASCADE,
blank=True, blank=True,
null=True, null=True,
limit_choices_to=(Q(membership__until__isnull=True) | limit_choices_to=registration_member_choices_limit
Q(membership__until__gt=timezone.now().date()))
) )
name = models.CharField( name = models.CharField(
......
Supports Markdown
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