mirror of
https://github.com/jwinterm/modoboa.git
synced 2026-10-18 05:51:26 +02:00
Merge branch '1.1.x'
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
# coding: utf-8
|
||||
import datetime
|
||||
from django import forms
|
||||
from django.utils.translation import ugettext as _, ugettext_lazy
|
||||
from django.utils import timezone
|
||||
@@ -42,20 +41,25 @@ class ARmessageForm(forms.ModelForm):
|
||||
"""Custom fields validaton.
|
||||
|
||||
We want to be sure that fromdate < untildate and that they are
|
||||
both in the future.
|
||||
both in the future ONLY IF the autoreply is beeing activated.
|
||||
|
||||
"""
|
||||
super(ARmessageForm, self).clean()
|
||||
if self._errors:
|
||||
raise forms.ValidationError(self._errors)
|
||||
if not self.cleaned_data["enabled"]:
|
||||
return self.cleaned_data
|
||||
if self.cleaned_data["fromdate"] is not None:
|
||||
if self.cleaned_data["fromdate"] < timezone.now():
|
||||
self._errors["fromdate"] = self.error_class([_("This date is over")])
|
||||
self._errors["fromdate"] = self.error_class(
|
||||
[_("This date is over")])
|
||||
del self.cleaned_data['fromdate']
|
||||
else:
|
||||
self.cleaned_data['fromdate'] = timezone.now()
|
||||
if self.cleaned_data["untildate"] is not None:
|
||||
if self.cleaned_data["untildate"] < timezone.now():
|
||||
self._errors["untildate"] = self.error_class([_("This date is over")])
|
||||
self._errors["untildate"] = self.error_class(
|
||||
[_("This date is over")])
|
||||
del self.cleaned_data['untildate']
|
||||
elif 'fromdate' in self.cleaned_data and \
|
||||
self.cleaned_data['untildate'] < self.cleaned_data['fromdate']:
|
||||
|
||||
@@ -37,6 +37,7 @@ $(document).ready(function() {
|
||||
<div id="listing"></div>
|
||||
{% endblock %}
|
||||
{% block footerleft %}
|
||||
{% if quota != -1 %}
|
||||
<div id="quotabox">
|
||||
<label class="pull-left navbar-text">{% trans "Mailbox quota" %}</label>
|
||||
<div id="quotabar" class="pull-left progress {% progress_color quota %}">
|
||||
@@ -44,5 +45,6 @@ $(document).ready(function() {
|
||||
</div>
|
||||
<label id="quotaraw" class="pull-left navbar-text">{{ quota }}%</label>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user