Commit 54444b31 authored by Skia's avatar Skia
Browse files

Some template improvements

parent 7aec32ce
Pipeline #213 failed with stage
in 2 minutes and 54 seconds
......@@ -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>
......
......@@ -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 %}
......@@ -54,4 +54,4 @@
{% endfor %}
</ul>
{% endif %}
{% endmacro %}
\ No newline at end of file
{% endmacro %}
......@@ -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() }}
......
......@@ -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) %}
......
......@@ -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")))
......
......@@ -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",
......
Markdown is supported
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