Commit 6597853a authored by stef's avatar stef
Browse files

[enh] full country names displayed

parent 5eacb3b4
...@@ -2,6 +2,7 @@ from django.template import Library, Variable ...@@ -2,6 +2,7 @@ from django.template import Library, Variable
from django.conf import settings from django.conf import settings
from django import template from django import template
import random import random
from nnmon.bt.models import COUNTRIES
register = Library() register = Library()
...@@ -13,3 +14,7 @@ def root_url(): ...@@ -13,3 +14,7 @@ def root_url():
def media_url(): def media_url():
return settings.MEDIA_URL return settings.MEDIA_URL
country_map=dict(COUNTRIES)
@register.filter(name='country')
def country(code):
return country_map[code]
...@@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist ...@@ -9,7 +9,7 @@ from django.core.exceptions import ObjectDoesNotExist
from django.contrib import messages from django.contrib import messages
from django.contrib.auth.models import User from django.contrib.auth.models import User
from django.utils.translation import ugettext_lazy as _ from django.utils.translation import ugettext_lazy as _
from models import Violation, Attachment, Comment, Confirmation, COUNTRIES from models import Violation, Attachment, Comment, Confirmation
from tempfile import mkstemp from tempfile import mkstemp
from datetime import datetime from datetime import datetime
import hashlib, os, re, json, smtplib import hashlib, os, re, json, smtplib
......
...@@ -131,7 +131,7 @@ $(document).ready(function(){ ...@@ -131,7 +131,7 @@ $(document).ready(function(){
<tbody> <tbody>
{% for violation in violations %} {% for violation in violations %}
<tr> <tr>
<td><a href="/view/{{violation.pk}}">{{ violation.operator }} ({{ violation.country }}) {{ violation.contract }}</a> <td><a href="/view/{{violation.pk}}">{{ violation.operator }} ({{ violation.country|country }}) {{ violation.contract }}</a>
<div class="info-validate"> <div class="info-validate">
<form method="get" id="{{ violation.pk }}" class="confirm_form" > <form method="get" id="{{ violation.pk }}" class="confirm_form" >
<label>{% trans "In order to <strong>validate your action</strong>, please enter your email address" %}</label> <label>{% trans "In order to <strong>validate your action</strong>, please enter your email address" %}</label>
......
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<tbody> <tbody>
{% for violation in violations %} {% for violation in violations %}
<tr> <tr>
<td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.country }}</a></td> <td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.country|country }}</a></td>
<td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.operator }}</a></td> <td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.operator }}</a></td>
<td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.contract }}</a></td> <td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.contract }}</a></td>
<td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.resource }}</a></td> <td><a class="cell-link" href="/view/{{violation.pk}}">{{ violation.resource }}</a></td>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment