diff --git a/conference/models.py b/conference/models.py index 4ba66129..75c91e56 100644 --- a/conference/models.py +++ b/conference/models.py @@ -1,4 +1,5 @@ # -*- coding: utf-8 -*- +import datetime from django.utils.translation import ugettext as _ from django.db import models from django.db.models import Q @@ -129,8 +130,15 @@ class Conference(TranslatableModel, EventMixin, ExpoMixin): #return list(Service.objects.language().filter(url__in=ids, type=Service.type.conference).order_by('sort')) def get_nearest_events(self): - conferences = Conference.objects.all()[:5] - return conferences + if self.theme.all(): + theme = self.theme.all()[0] + now = datetime.datetime.now() + now = now - datetime.timedelta(days=1) + conferences = Conference.objects.filter(theme__in=[theme], data_begin__gt=now).exclude(id=self.id).order_by('data_begin') + return conferences[:3] + else: + return [] + def get_catalog_url(self): return '/conference/' diff --git a/settings/templatetags/template_filters.py b/settings/templatetags/template_filters.py index 667ebc75..10c11444 100644 --- a/settings/templatetags/template_filters.py +++ b/settings/templatetags/template_filters.py @@ -251,7 +251,8 @@ def in_events(day, events): @register.filter def base64_encode(value): - return base64.b64encode(value) + + return base64.b64encode(value.encode("utf-8")) @register.filter diff --git a/templates/admin/base.html b/templates/admin/base.html index 743e7d89..9861275b 100644 --- a/templates/admin/base.html +++ b/templates/admin/base.html @@ -54,116 +54,12 @@ {# Side navigation #} {% block sidebar %} - + {% if user.is_superuser %} + {% include 'admin/includes/admin_nav.html' %} + {% else %} + {% include 'admin/includes/staff_nav.html' %} + {% endif %} + {% endblock %} diff --git a/templates/admin/includes/admin_nav.html b/templates/admin/includes/admin_nav.html new file mode 100644 index 00000000..51a37be8 --- /dev/null +++ b/templates/admin/includes/admin_nav.html @@ -0,0 +1,110 @@ + \ No newline at end of file diff --git a/templates/admin/includes/staff_nav.html b/templates/admin/includes/staff_nav.html new file mode 100644 index 00000000..24bdf99a --- /dev/null +++ b/templates/admin/includes/staff_nav.html @@ -0,0 +1,30 @@ + \ No newline at end of file diff --git a/templates/client/includes/exposition/exposition_list.html b/templates/client/includes/exposition/exposition_list.html index 61082756..a0e2fcba 100644 --- a/templates/client/includes/exposition/exposition_list.html +++ b/templates/client/includes/exposition/exposition_list.html @@ -8,20 +8,26 @@ {% for obj in objects %}
  • - - {% if obj.canceled %} -
    - {% else %} - {% if obj.expohit %} -
    - {% endif %} - {% endif %} -
    - {% with obj=obj %} - {% include 'client/includes/show_logo.html' %} - {% endwith %} -
    -
    + {% if not obj.canceled %} + + {% if obj.expohit %} +
    + {% endif %} +
    + {% with obj=obj %} + {% include 'client/includes/show_logo.html' %} + {% endwith %} +
    +
    + + {% else %} +
    +
    + {% with obj=obj %} + {% include 'client/includes/show_logo.html' %} + {% endwith %} +
    + {% endif %}
    {% if obj.quality_label.ufi.is_set %} diff --git a/templates/client/includes/header.html b/templates/client/includes/header.html index 3c1ee4ae..a8487e9b 100644 --- a/templates/client/includes/header.html +++ b/templates/client/includes/header.html @@ -35,8 +35,8 @@ {% endfor %} - {% if user.is_admin %} -
  • admin
  • + {% if user.is_staff %} +
  • admin
  • {% endif %}