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
ccb38dfe
Commit
ccb38dfe
authored
Sep 19, 2018
by
Luko van der Maas
Browse files
added some descriptions
parent
200f24ab
Changes
2
Show whitespace changes
Inline
Side-by-side
website/pushnotifications/migrations/0012_add_descriptions_categories.py
0 → 100644
View file @
ccb38dfe
# 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
)
]
website/pushnotifications/models.py
View file @
ccb38dfe
...
...
@@ -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
...
...
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