From 54444b31ba6b490ae448522ec2cce26bc77c508f Mon Sep 17 00:00:00 2001 From: Skia Date: Sun, 11 Sep 2016 19:00:12 +0200 Subject: [PATCH] Some template improvements --- club/templates/club/club_tools.jinja | 8 ++++++-- core/templates/core/macros.jinja | 6 +++--- launderette/templates/launderette/launderette_click.jinja | 1 - launderette/templates/launderette/launderette_main.jinja | 2 +- launderette/views.py | 4 ++-- sith/settings_sample.py | 2 ++ 6 files changed, 14 insertions(+), 9 deletions(-) diff --git a/club/templates/club/club_tools.jinja b/club/templates/club/club_tools.jinja index ca450eb2..ebae977c 100644 --- a/club/templates/club/club_tools.jinja +++ b/club/templates/club/club_tools.jinja @@ -3,17 +3,21 @@ {% block content %}

{% trans %}Club tools{% endtrans %}

- {% if object.counters.filter(type="OFFICE")|count > 0 %}

{% trans %}Counters:{% endtrans %}

{% endif %} + {% if object.club_account.exists() %}

{% trans %}Accouting: {% endtrans %}

{% endif %} -{% endmacro %} \ No newline at end of file +{% endmacro %} diff --git a/launderette/templates/launderette/launderette_click.jinja b/launderette/templates/launderette/launderette_click.jinja index 3ae92017..8709648c 100644 --- a/launderette/templates/launderette/launderette_click.jinja +++ b/launderette/templates/launderette/launderette_click.jinja @@ -7,7 +7,6 @@ {% block content %}

{% trans counter_name=counter %}{{ counter_name }} counter{% endtrans %}

- Counter: {{ counter }}
{% csrf_token %} {{ form.as_p() }} diff --git a/launderette/templates/launderette/launderette_main.jinja b/launderette/templates/launderette/launderette_main.jinja index 6075cc31..7628bd2a 100644 --- a/launderette/templates/launderette/launderette_main.jinja +++ b/launderette/templates/launderette/launderette_main.jinja @@ -5,7 +5,7 @@ {% endblock %} {% block content %} -{% if request.user.is_root %} +{% if request.user.can_edit(page) %}

{% trans %}Edit presentation page{% endtrans %}

{% endif %} {% if request.user.is_in_group(settings.SITH_MAIN_MEMBERS_GROUP) %} diff --git a/launderette/views.py b/launderette/views.py index 36f49624..87cfc006 100644 --- a/launderette/views.py +++ b/launderette/views.py @@ -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"))) diff --git a/sith/settings_sample.py b/sith/settings_sample.py index 6bdd3985..f4d6e5ea 100644 --- a/sith/settings_sample.py +++ b/sith/settings_sample.py @@ -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",