Some template improvements

This commit is contained in:
Skia 2016-09-11 19:00:12 +02:00
parent 7aec32cef0
commit 54444b31ba
6 changed files with 14 additions and 9 deletions

View File

@ -3,17 +3,21 @@
{% block content %}
<h3>{% trans %}Club tools{% endtrans %}</h3>
<div>
{% if object.counters.filter(type="OFFICE")|count > 0 %}
<h4>{% trans %}Counters:{% endtrans %}</h4>
<ul>
{% if object.unix_name == settings.SITH_LAUNDERETTE_MANAGER['unix_name'] %}
{% for l in Launderette.objects.all() %}
<li><a href="{{ url('launderette:main_click', launderette_id=l.id) }}">{{ l }}</a></li>
{% endfor %}
{% elif object.counters.filter(type="OFFICE")|count > 0 %}
{% for c in object.counters.filter(type="OFFICE") %}
<li>{{ c }}:
<a href="{{ url('counter:details', counter_id=c.id) }}">View</a>
<a href="{{ url('counter:admin', counter_id=c.id) }}">Edit</a>
</li>
{% endfor %}
</ul>
{% endif %}
</ul>
{% if object.club_account.exists() %}
<h4>{% trans %}Accouting: {% endtrans %}</h4>
<ul>

View File

@ -38,8 +38,8 @@
{% if get_subscriber(user).slots.exists() %}
<h5>{% trans %}Slot{% endtrans %}</h5>
<ul>
{% for i in get_subscriber(user).slots.all() %}
<li>{{ i.get_type_display() }} - {{i.machine.launderette }}, {{ i.start_date|localtime|date("l j") }} : {{ i.start_date|localtime|time(DATETIME_FORMAT) }}</li>
{% for i in get_subscriber(user).slots.filter(start_date__gte=timezone.now().replace(tzinfo=None)).all() %}
<li>{{ i.get_type_display() }} - {{i.machine.launderette }}, {{ i.start_date|date("l j") }} : {{ i.start_date|time(DATETIME_FORMAT) }}</li>
{% endfor %}
</ul>
{% endif %}

View File

@ -7,7 +7,6 @@
{% block content %}
<h3>{% trans counter_name=counter %}{{ counter_name }} counter{% endtrans %}</h3>
<div>
Counter: {{ counter }}
<form method="post" action="" class="inline" style="display:inline">
{% csrf_token %}
{{ form.as_p() }}

View File

@ -5,7 +5,7 @@
{% endblock %}
{% block content %}
{% if request.user.is_root %}
{% if request.user.can_edit(page) %}
<p><a href="{{ url('core:page_edit', page_name=page.get_full_name()) }}">{% trans %}Edit presentation page{% endtrans %}</a></p>
{% endif %}
{% if request.user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP) %}

View File

@ -8,7 +8,7 @@ from django.views.generic.edit import UpdateView, CreateView, DeleteView, BaseFo
from django.forms.models import modelform_factory
from django.forms import CheckboxSelectMultiple
from django.utils.translation import ugettext as _
from django.utils import dateparse
from django.utils import dateparse, timezone
from django.core.urlresolvers import reverse_lazy
from django.conf import settings
from django.db import transaction, DataError
@ -319,7 +319,7 @@ class LaunderetteClickView(CanEditMixin, DetailView, BaseFormView):
raise forms.ValidationError(_("Token not found"))
return t
return clean_field
for s in self.subscriber.slots.filter(token=None).all():
for s in self.subscriber.slots.filter(token=None, start_date__gte=timezone.now().replace(tzinfo=None)).all():
field_name = "slot-%s" % (str(s.id))
fields[field_name] = forms.CharField(max_length=5, required=False,
label="%s - %s" % (s.get_type_display(), defaultfilters.date(s.start_date, "j N Y H:i")))

View File

@ -111,8 +111,10 @@ TEMPLATES = [
"can_view": "core.views.can_view",
"get_subscriber": "subscription.views.get_subscriber",
"settings": "sith.settings",
"Launderette": "launderette.models.Launderette",
"Counter": "counter.models.Counter",
"ProductType": "counter.models.ProductType",
"timezone": "django.utils.timezone",
},
"bytecode_cache": {
"name": "default",