Commit 6a815e5a authored by Skia's avatar Skia

Small news improvement and bug fixes

parent 44dacce9
Pipeline #893 failed with stage
in 55 seconds
......@@ -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
......@@ -11,16 +11,6 @@
{% block content %}
{% if 'preview' in request.POST.keys() %}
<section class="news_event">
<h4> <a href="#">{{ form.instance.title }}</a></h4>
<p class="date">
<span>{{ form.instance.dates.first().start_date|localtime|time(DATETIME_FORMAT) }}</span> -
<span>{{ form.instance.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</span>
<p><a href="#">{{ or "Club" }}</a></p>
<p>{{ form.instance.summary|markdown }}</p>
<section class="news_event">
<h4>{{ form.instance.title }}</h4>
<p class="date">
......@@ -54,8 +54,10 @@ section.news_event:nth-of-type(even) {
<section class="news_event">
<h4> <a href="{{ url('com:news_detail', }}">{{ news.title }}</a></h4>
<p class="date">
<span>{{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }}</span> -
<span>{{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</span>
<span>{{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }}
{{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }}</span> -
<span>{{ news.dates.first().end_date|localtime|date(DATETIME_FORMAT) }}
{{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</span>
<p><a href="{{ }}">{{ }}</a></p>
<p>{{ news.summary|markdown }}</p>
......@@ -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
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