Commit ccb38dfe authored by Luko van der Maas's avatar Luko van der Maas
Browse files

added some descriptions

parent 200f24ab
# Generated by Django 2.0.8 on 2018-09-19 17:45
from django.db import migrations, models
def forwards_func(apps, schema_editor):
category = apps.get_model("pushnotifications", "Category")
db_alias = schema_editor.connection.alias
cat = category.objects.using(db_alias).get(key='general')
cat.description_en = "General association oriented notifications"
cat.description_nl = "Algemene vereneging gerelateerde notificaties"
cat.save()
cat = category.objects.using(db_alias).get(key='pizza')
cat.description_en = "Notifications related to the ordering and " \
"eating pizza's"
cat.description_nl = "Notificaties die gerelateerd zijn aan het " \
"bestellen en eten van pizza's"
cat.save()
cat = category.objects.using(db_alias).get(key='event')
cat.description_en = "Notifications related to registering and " \
"events in general"
cat.description_nl = "Notificaties gerelateerd aan het registreren van " \
"evenementen en evenementen in het algemeneen"
cat.save()
cat = category.objects.using(db_alias).get(key='newsletter')
cat.description_en = ""
cat.description_nl = ""
cat.save()
cat = category.objects.using(db_alias).get(key='partner')
cat.description_en = "Notifications related to partners"
cat.description_nl = "Notificaties gerelateerd aan partners"
cat.save()
cat = category.objects.using(db_alias).get(key='photo')
cat.description_en = "Notifications about when new photo's are uploaded"
cat.description_nl = "Notificaties voor wanneer foto's zijn geupload"
cat.save()
cat = category.objects.using(db_alias).get(key='board')
cat.description_en = "Notifications by the board"
cat.description_nl = "Notificaties van het bestuur"
cat.save()
def reverse_func(apps, schema_editor):
category = apps.get_model("pushnotifications", "Category")
db_alias = schema_editor.connection.alias
for key in ['general', 'pizza', 'event', 'newsletter',
'sponsor', 'photo', 'board']:
cat = category.objects.using(db_alias).get(key=key)
cat.name_en = cat.name_en.lower()
cat.name_nl = cat.name_nl.lower()
cat.save()
class Migration(migrations.Migration):
dependencies = [
('pushnotifications', '0011_message_url'),
]
operations = [
migrations.AddField(
model_name='category',
name='description_en',
field=models.TextField(default='', verbose_name='description (EN)'),
),
migrations.AddField(
model_name='category',
name='description_nl',
field=models.TextField(default='', verbose_name='description (NL)'),
),
migrations.RunPython(forwards_func, reverse_func)
]
......@@ -21,6 +21,12 @@ class Category(models.Model, metaclass=ModelTranslateMeta):
max_length=32,
)
description = MultilingualField(
models.TextField,
_("description"),
default=""
)
def __str__(self):
return self.name_en
......
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