Skip to content
GitLab
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
11fdaa92
Verified
Commit
11fdaa92
authored
Aug 27, 2018
by
Sébastiaan Versteeg
Browse files
Rename the notification category for partners
parent
25937476
Changes
2
Hide whitespace changes
Inline
Side-by-side
website/pushnotifications/migrations/0010_rename_partner_category.py
0 → 100644
View file @
11fdaa92
from
django.db
import
migrations
def
forwards_func
(
apps
,
schema_editor
):
category
=
apps
.
get_model
(
"pushnotifications"
,
"Category"
)
db_alias
=
schema_editor
.
connection
.
alias
category
.
objects
.
using
(
db_alias
).
get
(
key
=
'sponsor'
).
delete
()
category
.
objects
.
create
(
key
=
'partner'
,
name_nl
=
'Partners'
,
name_en
=
'Partners'
,
)
def
reverse_func
(
apps
,
schema_editor
):
category
=
apps
.
get_model
(
"pushnotifications"
,
"Category"
)
db_alias
=
schema_editor
.
connection
.
alias
category
.
objects
.
using
(
db_alias
).
get
(
key
=
'partner'
).
delete
()
category
.
objects
.
create
(
key
=
'sponsor'
,
name_nl
=
'Sponsor'
,
name_en
=
'Sponsor'
,
)
class
Migration
(
migrations
.
Migration
):
dependencies
=
[
(
'pushnotifications'
,
'0009_rename_categories'
),
]
operations
=
[
migrations
.
RunPython
(
forwards_func
,
reverse_func
),
]
website/pushnotifications/models.py
View file @
11fdaa92
...
...
@@ -80,24 +80,6 @@ class Message(models.Model, metaclass=ModelTranslateMeta):
objects
=
MessageManager
()
GENERAL
=
'general'
PIZZA
=
'pizza'
EVENT
=
'event'
NEWSLETTER
=
'newsletter'
PARTNER
=
'partner'
PHOTO
=
'photo'
BOARD
=
'board'
CATEGORIES
=
(
(
GENERAL
,
_
(
"General"
)),
(
PIZZA
,
_
(
"Pizza"
)),
(
EVENT
,
_
(
"Events"
)),
(
NEWSLETTER
,
_
(
"Newsletter"
)),
(
PARTNER
,
_
(
"Messages from partners"
)),
(
PHOTO
,
_
(
"Photos"
)),
(
BOARD
,
_
(
"Board"
)),
)
users
=
models
.
ManyToManyField
(
settings
.
AUTH_USER_MODEL
)
title
=
MultilingualField
(
models
.
CharField
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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