mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-26 02:54:20 +00:00
Small news improvement and bug fixes
This commit is contained in:
parent
44dacce9f2
commit
6a815e5a21
@ -4,6 +4,7 @@ from django.utils.translation import ugettext_lazy as _
|
|||||||
from django.core.urlresolvers import reverse_lazy, reverse
|
from django.core.urlresolvers import reverse_lazy, reverse
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.core.mail import EmailMultiAlternatives
|
from django.core.mail import EmailMultiAlternatives
|
||||||
|
from django.core.exceptions import ValidationError
|
||||||
|
|
||||||
from core.models import User, Preferences
|
from core.models import User, Preferences
|
||||||
from club.models import Club
|
from club.models import Club
|
||||||
|
@ -11,16 +11,6 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
{% if 'preview' in request.POST.keys() %}
|
{% 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>
|
|
||||||
<p><a href="#">{{ form.instance.club or "Club" }}</a></p>
|
|
||||||
<p>{{ form.instance.summary|markdown }}</p>
|
|
||||||
</section>
|
|
||||||
<hr>
|
|
||||||
<section class="news_event">
|
<section class="news_event">
|
||||||
<h4>{{ form.instance.title }}</h4>
|
<h4>{{ form.instance.title }}</h4>
|
||||||
<p class="date">
|
<p class="date">
|
||||||
|
@ -54,8 +54,10 @@ section.news_event:nth-of-type(even) {
|
|||||||
<section class="news_event">
|
<section class="news_event">
|
||||||
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>
|
<h4> <a href="{{ url('com:news_detail', news_id=news.id) }}">{{ news.title }}</a></h4>
|
||||||
<p class="date">
|
<p class="date">
|
||||||
<span>{{ news.dates.first().start_date|localtime|time(DATETIME_FORMAT) }}</span> -
|
<span>{{ news.dates.first().start_date|localtime|date(DATETIME_FORMAT) }}
|
||||||
<span>{{ news.dates.first().end_date|localtime|time(DATETIME_FORMAT) }}</span>
|
{{ 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>
|
</p>
|
||||||
<p><a href="{{ news.club.get_absolute_url() }}">{{ news.club }}</a></p>
|
<p><a href="{{ news.club.get_absolute_url() }}">{{ news.club }}</a></p>
|
||||||
<p>{{ news.summary|markdown }}</p>
|
<p>{{ news.summary|markdown }}</p>
|
||||||
|
@ -107,6 +107,8 @@ class NewsForm(forms.ModelForm):
|
|||||||
self.add_error('start_date', ValidationError(_("This field is required.")))
|
self.add_error('start_date', ValidationError(_("This field is required.")))
|
||||||
if not self.cleaned_data['end_date']:
|
if not self.cleaned_data['end_date']:
|
||||||
self.add_error('end_date', ValidationError(_("This field is required.")))
|
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']:
|
if self.cleaned_data['type'] == "WEEKLY" and not self.cleaned_data['until']:
|
||||||
self.add_error('until', ValidationError(_("This field is required.")))
|
self.add_error('until', ValidationError(_("This field is required.")))
|
||||||
return self.cleaned_data
|
return self.cleaned_data
|
||||||
|
Loading…
Reference in New Issue
Block a user