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
La Quadrature du Net
Respect My Net
Commits
093b4229
Commit
093b4229
authored
Nov 20, 2011
by
Baptiste Jonglez
Browse files
[fix] i18n of 'media' and 'type' in view
parent
0e0f7b87
Changes
2
Hide whitespace changes
Inline
Side-by-side
bt/templatetags/bt.py
View file @
093b4229
...
...
@@ -2,7 +2,7 @@ from django.template import Library, Variable
from
django.conf
import
settings
from
django
import
template
import
random
from
nnmon.bt.models
import
COUNTRIES
,
STATUS
from
nnmon.bt.models
import
COUNTRIES
,
STATUS
,
TYPES
,
MEDIA
register
=
Library
()
...
...
@@ -23,3 +23,13 @@ status_map=dict(STATUS)
@
register
.
filter
(
name
=
'status'
)
def
status
(
code
):
return
status_map
[
code
]
types_map
=
dict
(
TYPES
)
@
register
.
filter
(
name
=
'types'
)
def
types
(
code
):
return
types_map
[
code
]
media_map
=
dict
(
MEDIA
)
@
register
.
filter
(
name
=
'media'
)
def
media
(
code
):
return
media_map
[
code
]
templates/view.html
View file @
093b4229
...
...
@@ -66,8 +66,8 @@ $(document).ready(function() {
</div>
<dl>
{%if v.resource_name%}
<dt>
{% trans "Affected resource" %}
</dt><dd>
{{v.resource_name}}
</dd>
{%endif%}
{%if v.type%}
<dt>
{% trans "Type" %}
</dt><dd>
{{v.type}}
</dd>
{%endif%}
{%if v.media%}
<dt>
{% trans "Media" %}
</dt><dd>
{{v.media}}
</dd>
{%endif%}
{%if v.type%}
<dt>
{% trans "Type" %}
</dt><dd>
{{v.type
|types
}}
</dd>
{%endif%}
{%if v.media%}
<dt>
{% trans "Media" %}
</dt><dd>
{{v.media
|media
}}
</dd>
{%endif%}
{%if v.state%}
<dt>
{% trans "Status" %}
</dt><dd>
{{v.state|status}}
</dd>
{%endif%}
{%if v.temporary%}
<dt>
{% trans "Temporary restriction" %}
</dt><dd>
{{v.temporary}}
</dd>
{%endif%}
{%if v.loophole%}
<dt>
{% trans "Another offer provided by the same operator removes this restriction" %}
</dt><dd>
{% trans "yes" %}
</dd>
{%endif%}
...
...
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