зеркало из https://github.com/mozilla/kitsune.git
[Bug 858575] Add category for canned responses.
This commit is contained in:
Родитель
f572a34291
Коммит
d87fb331a3
|
@ -177,6 +177,7 @@ HOW_TO_CONTRIBUTE_CATEGORY = 30
|
|||
ADMINISTRATION_CATEGORY = 40
|
||||
NAVIGATION_CATEGORY = 50
|
||||
TEMPLATES_CATEGORY = 60
|
||||
CANNED_RESPONSES_CATEGORY = 70
|
||||
|
||||
CATEGORIES = (
|
||||
(TROUBLESHOOTING_CATEGORY, _lazy(u'Troubleshooting')),
|
||||
|
@ -185,6 +186,7 @@ CATEGORIES = (
|
|||
(ADMINISTRATION_CATEGORY, _lazy(u'Administration')),
|
||||
(NAVIGATION_CATEGORY, _lazy(u'Navigation')),
|
||||
(TEMPLATES_CATEGORY, _lazy(u'Templates')),
|
||||
(CANNED_RESPONSES_CATEGORY, _lazy(u'Canned Responses')),
|
||||
)
|
||||
|
||||
REDIRECT_HTML = '<p>REDIRECT <a ' # how a redirect looks as rendered HTML
|
||||
|
|
|
@ -0,0 +1,23 @@
|
|||
"""
|
||||
All the forum canned responses are stored in KB articles. There is a
|
||||
category for them now. Luckily they follow a simple pattern of slugs, so
|
||||
they are easy to find.
|
||||
|
||||
This could have been an SQL migration, but I'm lazy and prefer Python.
|
||||
"""
|
||||
from django.conf import settings
|
||||
|
||||
from wiki.models import Document
|
||||
from wiki.config import CANNED_RESPONSES_CATEGORY
|
||||
|
||||
to_move = list(Document.objects.filter(slug__startswith='forum-response-',
|
||||
locale=settings.WIKI_DEFAULT_LANGUAGE))
|
||||
to_move.append(Document.objects.get(slug='common-forum-responses',
|
||||
locale=settings.WIKI_DEFAULT_LANGUAGE))
|
||||
|
||||
print 'Recategorizing %d common response articles.' % len(to_move)
|
||||
|
||||
for doc in to_move:
|
||||
doc.category = CANNED_RESPONSES_CATEGORY
|
||||
doc.is_localizable = True
|
||||
doc.save()
|
Загрузка…
Ссылка в новой задаче