fnp
/
prawokultury.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
fix sending answer
[prawokultury.git]
/
events
/
models.py
diff --git
a/events/models.py
b/events/models.py
index
e20ae53
..
1151a11
100644
(file)
--- a/
events/models.py
+++ b/
events/models.py
@@
-6,11
+6,13
@@
from django.conf import settings
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
from django.core.exceptions import ValidationError
from django.db import models
from django.utils.translation import ugettext_lazy as _, ugettext
-from
migdal.helpers
import add_translatable
+from
fnpdjango.utils.models.translation
import add_translatable
class Event(models.Model):
date = models.DateTimeField(_('date'), max_length=255, db_index=True)
class Event(models.Model):
date = models.DateTimeField(_('date'), max_length=255, db_index=True)
+ date_end = models.DateTimeField(_('end date'), max_length=255,
+ db_index=True, blank=True)
link = models.URLField(_('link'))
class Meta:
link = models.URLField(_('link'))
class Meta:
@@
-22,6
+24,12
@@
class Event(models.Model):
return self.title
def clean(self):
return self.title
def clean(self):
+ if self.date_end:
+ if self.date_end < self.date:
+ raise ValidationError(
+ ugettext("End date must not be earlier than start."))
+ else:
+ self.date_end = self.date
for lc, ln in settings.LANGUAGES:
if (getattr(self, "published_%s" % lc) and
not getattr(self, "title_%s" % lc)):
for lc, ln in settings.LANGUAGES:
if (getattr(self, "published_%s" % lc) and
not getattr(self, "title_%s" % lc)):