diff --git a/com/models.py b/com/models.py index ab750c82..670415d5 100644 --- a/com/models.py +++ b/com/models.py @@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse_lazy, reverse from django.conf import settings from django.core.mail import EmailMultiAlternatives +from django.core.exceptions import ValidationError from core.models import User, Preferences from club.models import Club diff --git a/com/templates/com/news_edit.jinja b/com/templates/com/news_edit.jinja index 1fa00414..ea4fb73a 100644 --- a/com/templates/com/news_edit.jinja +++ b/com/templates/com/news_edit.jinja @@ -11,16 +11,6 @@ {% block content %} {% if 'preview' in request.POST.keys() %} -
-

{{ form.instance.title }}

-

- {{ form.instance.dates.first().start_date|localtime|time(DATETIME_FORMAT) }} - - {{ form.instance.dates.first().end_date|localtime|time(DATETIME_FORMAT) }} -

-

{{ form.instance.club or "Club" }}

-

{{ form.instance.summary|markdown }}

-
-

{{ form.instance.title }}

diff --git a/com/templates/com/news_list.jinja b/com/templates/com/news_list.jinja index af11e362..bd714fd3 100644 --- a/com/templates/com/news_list.jinja +++ b/com/templates/com/news_list.jinja @@ -54,8 +54,10 @@ section.news_event:nth-of-type(even) {

{{ news.title }}

- {{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }} - - {{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }} + {{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }} + {{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }} - + {{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }} + {{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}

{{ news.club }}

{{ news.summary|markdown }}

diff --git a/com/views.py b/com/views.py index b3107c99..75233ca2 100644 --- a/com/views.py +++ b/com/views.py @@ -107,6 +107,8 @@ class NewsForm(forms.ModelForm): self.add_error('start_date', ValidationError(_("This field is required."))) if not self.cleaned_data['end_date']: self.add_error('end_date', ValidationError(_("This field is required."))) + if self.cleaned_data['start_date'] > self.cleaned_data['end_date']: + self.add_error('end_date', ValidationError(_("You crazy? You can not finish an event before starting it."))) if self.cleaned_data['type'] == "WEEKLY" and not self.cleaned_data['until']: self.add_error('until', ValidationError(_("This field is required."))) return self.cleaned_data