Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
converse.js
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
converse.js
Commits
6172717a
Commit
6172717a
authored
Apr 16, 2012
by
Michal Čihař
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Automatically setup languages on syncdb
parent
0ac57368
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
0 deletions
+7
-0
lang/models.py
lang/models.py
+7
-0
No files found.
lang/models.py
View file @
6172717a
...
...
@@ -3,6 +3,7 @@ from django.db import models
from
django.utils.translation
import
ugettext
as
_
from
django.db.models
import
Sum
from
translate.lang
import
data
from
django.db.models.signals
import
post_syncdb
EXTRALANGS
=
[
(
'ur'
,
'Urdu'
,
2
,
'(n != 1)'
),
...
...
@@ -88,6 +89,12 @@ class LanguageManager(models.Manager):
lang
.
save
()
def
setup_lang
(
sender
=
None
,
**
kwargs
):
if
sender
.
__name__
==
'lang.models'
:
Language
.
objects
.
setup
(
False
)
post_syncdb
.
connect
(
setup_lang
)
class
Language
(
models
.
Model
):
code
=
models
.
SlugField
(
unique
=
True
)
name
=
models
.
CharField
(
max_length
=
100
)
...
...
Write
Preview
Markdown
is supported
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