Improve event categories

parent e0210936
This diff was suppressed by a .gitattributes entry.
...@@ -56,7 +56,7 @@ msgstr "Je aanmelding is succesvol opgeslagen." ...@@ -56,7 +56,7 @@ msgstr "Je aanmelding is succesvol opgeslagen."
#: admin_views.py #: admin_views.py
msgid "Send push notification" msgid "Send push notification"
msgstr "verstuur pushnotificatie" msgstr "Verstuur pushnotificatie"
#: admin_views.py #: admin_views.py
msgid "Message sent successfully." msgid "Message sent successfully."
...@@ -158,33 +158,25 @@ msgstr "Bericht (NL)" ...@@ -158,33 +158,25 @@ msgstr "Bericht (NL)"
msgid "The notification opens to the event by default." msgid "The notification opens to the event by default."
msgstr "De notificatie opent standaard het evenement." msgstr "De notificatie opent standaard het evenement."
#: models.py #: models.py templates/events/alumni.html
msgid "Drinks" msgid "Alumni"
msgstr "Borrel" msgstr "Alumni"
#: models.py
msgid "Activity"
msgstr "Activiteit"
#: models.py #: models.py
msgid "Lunch Lecture" msgid "Education"
msgstr "Lunchlezing" msgstr "Educatief"
#: models.py #: models.py
msgid "General Meeting" msgid "Career"
msgstr "Algemene ledenvergadering" msgstr "Carrière"
#: models.py #: models.py
msgid "Workshop" msgid "Leisure"
msgstr "Workshop" msgstr "Vrije tijd"
#: models.py templates/events/alumni.html
msgid "Alumni"
msgstr "Alumni"
#: models.py #: models.py
msgid "Party" msgid "Association Affairs"
msgstr "Feest" msgstr "Verenigingszaken"
#: models.py #: models.py
msgid "Other" msgid "Other"
...@@ -226,6 +218,19 @@ msgstr "organisator" ...@@ -226,6 +218,19 @@ msgstr "organisator"
msgid "category" msgid "category"
msgstr "categorie" msgstr "categorie"
#: models.py
msgid ""
"Alumni: Events organised for alumni, Education: Education focused events, "
"Career: Career focused events, Leisure: borrels, parties, game activities "
"etc., Association Affairs: general meetings or any other board related "
"events, Other: anything else."
msgstr ""
"Alumni: Evenementen voor alumni, Educatief: Op onderwijs gerichte "
"evenementen, Carrière: Op carrière gerichte evenementen, Vrije tijd: "
"borrels, feesten, spelactiviteiten etc., Verenigingszaken: algemene "
"vergaderingen en andere bestuur gerelateerde evenementen, Overig: al het "
"andere."
#: models.py #: models.py
msgid "registration start" msgid "registration start"
msgstr "start aanmelden" msgstr "start aanmelden"
......
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations
MIGRATION_MAP = {
'drinks': 'leisure',
'activity': 'other',
'generalmeeting': 'association',
'workshop': 'education',
'lunchlecture': 'education',
'party': 'leisure'
}
def forwards_func(apps, schema_editor):
Event = apps.get_model('events', 'event')
db_alias = schema_editor.connection.alias
for cat, val in MIGRATION_MAP.items():
for e in Event.objects.using(db_alias).filter(category=cat):
e.category = val
e.save()
def reverse_func(apps, schema_editor):
Event = apps.get_model('events', 'event')
db_alias = schema_editor.connection.alias
for cat, val in MIGRATION_MAP.items():
for e in Event.objects.using(db_alias).filter(category=val):
e.category = cat
e.save()
class Migration(migrations.Migration):
dependencies = [
('events', '0035_registration_payment_obj'),
]
operations = [
migrations.RunPython(forwards_func, reverse_func),
]
# Generated by Django 2.2.1 on 2019-08-04 11:51
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('events', '0036_category_improvement'),
]
operations = [
migrations.AlterField(
model_name='event',
name='category',
field=models.CharField(choices=[('alumni', 'Alumni'), ('education', 'Education'), ('career', 'Career'), ('leisure', 'Leisure'), ('association', 'Association Affairs'), ('other', 'Other')], help_text='Alumni: Events organised for alumni, Education: Education focused events, Career: Career focused events, Leisure: borrels, parties, game activities etc., Association Affairs: general meetings or any other board related events, Other: anything else.', max_length=40, verbose_name='category'),
),
]
...@@ -20,23 +20,19 @@ from utils.translation import ModelTranslateMeta, MultilingualField ...@@ -20,23 +20,19 @@ from utils.translation import ModelTranslateMeta, MultilingualField
class Event(models.Model, metaclass=ModelTranslateMeta): class Event(models.Model, metaclass=ModelTranslateMeta):
"""Describes an event""" """Describes an event"""
CATEGORY_DRINKS = 'drinks'
CATEGORY_ACTIVITY = 'activity'
CATEGORY_LUNCH = 'lunchlecture'
CATEGORY_MEETING = 'generalmeeting'
CAGTEGORY_WORKSHOP = 'workshop'
CATEGORY_ALUMNI = 'alumni' CATEGORY_ALUMNI = 'alumni'
CATEGORY_PARTY = 'party' CATEGORY_EDUCATION = 'education'
CATEGORY_CAREER = 'career'
CATEGORY_LEISURE = 'leisure'
CATEGORY_ASSOCIATION = 'association'
CATEGORY_OTHER = 'other' CATEGORY_OTHER = 'other'
EVENT_CATEGORIES = ( EVENT_CATEGORIES = (
(CATEGORY_DRINKS, _('Drinks')),
(CATEGORY_ACTIVITY, _('Activity')),
(CATEGORY_LUNCH, _('Lunch Lecture')),
(CATEGORY_MEETING, _('General Meeting')),
(CAGTEGORY_WORKSHOP, _('Workshop')),
(CATEGORY_ALUMNI, _('Alumni')), (CATEGORY_ALUMNI, _('Alumni')),
(CATEGORY_PARTY, _('Party')), (CATEGORY_EDUCATION, _('Education')),
(CATEGORY_CAREER, _('Career')),
(CATEGORY_LEISURE, _('Leisure')),
(CATEGORY_ASSOCIATION, _('Association Affairs')),
(CATEGORY_OTHER, _('Other'))) (CATEGORY_OTHER, _('Other')))
DEFAULT_NO_REGISTRATION_MESSAGE = _('No registration required / ' DEFAULT_NO_REGISTRATION_MESSAGE = _('No registration required / '
...@@ -70,7 +66,13 @@ class Event(models.Model, metaclass=ModelTranslateMeta): ...@@ -70,7 +66,13 @@ class Event(models.Model, metaclass=ModelTranslateMeta):
max_length=40, max_length=40,
choices=EVENT_CATEGORIES, choices=EVENT_CATEGORIES,
verbose_name=_('category'), verbose_name=_('category'),
default='other' help_text=_('Alumni: Events organised for alumni, '
'Education: Education focused events, '
'Career: Career focused events, '
'Leisure: borrels, parties, game activities etc., '
'Association Affairs: general meetings or '
'any other board related events, '
'Other: anything else.')
) )
registration_start = models.DateTimeField( registration_start = models.DateTimeField(
......
...@@ -267,7 +267,7 @@ class Command(BaseCommand): ...@@ -267,7 +267,7 @@ class Command(BaseCommand):
duration = math.ceil(random.expovariate(0.2)) duration = math.ceil(random.expovariate(0.2))
event.end = event.start + timedelta(hours=duration) event.end = event.start + timedelta(hours=duration)
event.organiser = random.choice(groups) event.organiser = random.choice(groups)
event.category = random.choice(Event.EVENT_CATEGORIES) event.category = random.choice(Event.EVENT_CATEGORIES)[0]
if random.random() < 0.5: if random.random() < 0.5:
week = timedelta(days=7) week = timedelta(days=7)
......
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