msgstr "Date d'expiration"
#: templates/telemeta_default/profile_detail.html:19
-msgid "Is admin"
-msgstr "Est admin"
+msgid "Is staff"
+msgstr "Statut équipe"
#: templates/telemeta_default/profile_detail.html:20
msgid "Is superuser"
-msgstr "Est superuser"
+msgstr "Statut super-utilisateur"
#: templates/telemeta_default/profile_detail.html:21
msgid "Last login"
{% extends "telemeta/admin.html" %}
+{% load telemeta_utils %}
+{% load i18n %}
-{% block tab %}
-<div class="tabs">
-{% if instruments %}
- <ul>
+{% block tabcontents %}
+ <h4>{% trans "Instruments" %}</h4>
+
+ <form class="addnew" id="addenum" method="post"
+ action="{% url telemeta-admin-instruments %}">{% csrf_token %}
+ <fieldset>
+ <legend>{% trans "Add entry" %}</legend>
+ <div class="field">
+ <label>{% trans "Name" %}: <input type="text" name="value"></label>
+
+ </div>
+ <div class="buttons">
+ <input type="submit" name="add" value="{% trans 'Add' %}">
+ </div>
+ </fieldset>
+ </form>
+ {% if instruments %}
+ <form method="POST" action="{% url telemeta-admin-instruments %}">{% csrf_token %}
+ <table class="listing">
+ <thead>
+ <tr><th class="sel"> </th><th>{% trans "Name"%}</th>
+
+ </tr>
+ </thead><tbody>
{% for instrument in instruments %}
- <li>{{ instrument|capfirst }}</li>
+ <tr>
+ <td><input type="checkbox" name="sel" value="{{instrument.id}}" /></td>
+ <td>
+ {{instrument.name}}</td>
+ </tr>
{% endfor %}
- </ul>
-{% else %}
-No intruments
-{% endif %}
-</div>
-{% endblock tab %}
+ </tbody>
+ </table>
+ <div class="buttons">
+ <input type="submit" name="remove" value="{% trans 'Remove selected items' %}" />
+ </div>
+ </form>
+ {% else %}
+ <p class="help">{% trans "No instruments" %}</p>
+ {% endif %}
+
+ <br style="clear: right"/>
+{% endblock %}
+
{% endif %}
</td>
<td>{{ r.revision.element_type }}</td>
- <td>{% if r.revision.user %}{{ r.revision.user.username }}{% endif %}</td>
+ <td>{% if r.revision.user %}<a href="{% url telemeta-profile-detail r.revision.user.username %}">{{ r.revision.user.username }}</a>{% endif %}</td>
</tr>
{% endfor %}
<dt>{% trans "Telephone" %}</dt><dd>{% if profile %}{{ profile.telephone }}{% endif %}</dd>
<dt>{% trans "Expiration date" %}</dt><dd>{% if profile %}{{ profile.expiration_date }}{% endif %}</dd>
- <dt>{% trans "Is admin" %}</dt><dd>{{ usr.is_staff }}</dd>
+ <dt>{% trans "Is staff" %}</dt><dd>{{ usr.is_staff }}</dd>
<dt>{% trans "Is superuser" %}</dt><dd>{{ usr.is_superuser }}</dd>
<dt>{% trans "Last login" %}</dt><dd>{{ usr.last_login }}</dd>
</dl>
{% if not field.html_name in hidden_fields %}
<tr>
<tr><td class="error">{{ field.errors }}</td></tr>
- <td>{% trans field.label_tag %}:</td><td>{{ field }}</td>
+ <td>{% trans field.label_tag %} : </td><td>{{ field }}</td>
</tr>
{% else %}
<tr>
url(r'^admin/enumerations/$', web_view.admin_enumerations, name="telemeta-admin-enumerations"),
url(r'^admin/instruments/$', web_view.admin_instruments, name="telemeta-admin-instruments"),
+ # instruments administration
+ url(r'^admin/instruments/(?P<instrument_id>[0-9]+)/edit/$', web_view.admin_instrument_edit, name="telemeta-admin-instruments-edit"),
+
# enumerations administration
url(r'^admin/enumerations/(?P<enumeration_id>[0-9a-z]+)/$',
web_view.edit_enumeration ,
@method_decorator(permission_required('sites.change_site'))
def admin_instruments(self, request):
- objects = Instrument.objects.all()
- instruments = []
- for instrument in objects:
- instruments.append(instrument.name)
- instruments.sort()
+ instruments = Instrument.objects.all().order_by('name')
return render(request, 'telemeta/admin_instruments.html', {'instruments': instruments})
+ @method_decorator(permission_required('telemeta.change_instrument'))
+ def admin_instrument_edit(self, request, instrument_id):
+ instrument = Instrument.objects.get(pk=instrument_id)
+ vars = self.__get_admin_context_vars()
+ render(request, 'telemeta/enumeration_edit_value.html', vars)
+
def __get_enumeration(self, id):
from django.db.models import get_models
models = get_models(telemeta.models)
profile = user.get_profile()
except:
profile = UserProfile(user=user)
-# profile.save()
if request.method == 'POST':
user_form = UserChangeForm(request.POST, instance=user, prefix='user')