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
La Quadrature du Net
piphone
campaign
Commits
51b73cce
Commit
51b73cce
authored
Nov 22, 2014
by
Aymeric Barantal
Browse files
use normalized language list
parent
d2be7fff
Changes
1
Hide whitespace changes
Inline
Side-by-side
picampaign/campaign/models.py
View file @
51b73cce
from
django.db
import
models
from
django.utils.translation
import
ugettext_lazy
as
_
from
django.conf
import
settings
LANGUAGES
=
map
(
lambda
(
k
,
v
):
(
k
,
_
(
v
)),
settings
.
LANGUAGES
)
class
Contact
(
models
.
Model
):
...
...
@@ -21,7 +26,9 @@ class Campaign(models.Model):
description
=
models
.
CharField
(
max_length
=
512
,
blank
=
True
)
start_date
=
models
.
DateField
()
end_date
=
models
.
DateField
()
default_lang
=
models
.
CharField
(
max_length
=
5
)
default_lang
=
models
.
CharField
(
max_length
=
5
,
choices
=
LANGUAGES
,
verbose_name
=
_
(
'language'
))
def
__unicode__
(
self
):
return
self
.
title
...
...
@@ -31,7 +38,9 @@ class Argumentary(models.Model):
"""Argumentary in a given language for a campaign"""
id
=
models
.
AutoField
(
primary_key
=
True
)
campaign
=
models
.
ForeignKey
(
Campaign
)
lang
=
models
.
CharField
(
max_length
=
255
)
lang
=
models
.
CharField
(
max_length
=
5
,
choices
=
LANGUAGES
,
verbose_name
=
_
(
'language'
))
text
=
models
.
TextField
(
null
=
True
)
def
__unicode__
(
self
):
...
...
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