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
312a8535
Commit
312a8535
authored
Aug 06, 2016
by
Porkepix
Browse files
Clean unicode specific parts in files
Everything is unicode in Python3
parent
748adc80
Changes
4
Hide whitespace changes
Inline
Side-by-side
picampaign/campaign/models.py
View file @
312a8535
...
...
@@ -21,7 +21,7 @@ class Campaign(models.Model):
choices
=
LANGUAGES
,
verbose_name
=
_
(
'language'
))
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
title
.
decode
(
'utf-8'
)
...
...
@@ -34,7 +34,7 @@ class Argumentary(models.Model):
verbose_name
=
_
(
'language'
))
text
=
models
.
TextField
(
null
=
True
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
args
=
{
'lang'
:
self
.
lang
,
'title'
:
self
.
campaign
.
title
}
return
_
(
'Argumentary in %(lang)s for %(title)s'
)
%
args
...
...
picampaign/contact/models.py
View file @
312a8535
...
...
@@ -12,7 +12,7 @@ class Contact(models.Model):
mail
=
models
.
CharField
(
max_length
=
255
,
blank
=
True
)
photo
=
models
.
ImageField
(
upload_to
=
'contacts/photos'
,
blank
=
True
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
_
(
u
'%(firstname)s %(lastname)s'
)
%
{
'firstname'
:
self
.
first_name
,
'lastname'
:
self
.
last_name
}
...
...
@@ -24,5 +24,5 @@ class Contact(models.Model):
def
get_photo_url
(
self
):
if
self
.
photo
:
return
self
.
photo
.
url
return
u
''
return
''
picampaign/feedback/models.py
View file @
312a8535
...
...
@@ -10,7 +10,7 @@ class Feedback(models.Model):
category
=
models
.
ForeignKey
(
FeedbackCategory
)
comment
=
models
.
CharField
(
max_length
=
512
,
blank
=
True
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
_
(
'feedback for %(callee contact)s on %(campaign title)s'
)
%
\
{
'callee contact'
:
self
.
callee
.
contact
,
'campaign title'
:
self
.
callee
.
campaign
.
title
}
picampaign/organization/models.py
View file @
312a8535
...
...
@@ -10,7 +10,7 @@ class Organization(models.Model):
users
=
models
.
ManyToManyField
(
User
,
null
=
True
,
blank
=
True
,
related_name
=
'organizations'
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
name
...
...
@@ -19,7 +19,7 @@ class GroupType(models.Model):
organization
=
models
.
ForeignKey
(
Organization
)
name
=
models
.
CharField
(
max_length
=
64
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
name
...
...
@@ -33,7 +33,7 @@ class Group(models.Model):
contacts
=
models
.
ManyToManyField
(
Contact
,
null
=
True
,
blank
=
True
,
related_name
=
'groups'
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
name
...
...
@@ -42,5 +42,5 @@ class FeedbackCategory(models.Model):
name
=
models
.
CharField
(
max_length
=
64
)
organization
=
models
.
ForeignKey
(
Organization
)
def
__
unicode
__
(
self
):
def
__
str
__
(
self
):
return
self
.
name
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