update admin view of event
This commit is contained in:
@@ -239,6 +239,9 @@ class Event(Post):
|
|||||||
class Meta:
|
class Meta:
|
||||||
proxy = True
|
proxy = True
|
||||||
|
|
||||||
|
verbose_name = "Event"
|
||||||
|
verbose_name_plural = "Events"
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def event_start_month(self):
|
def event_start_month(self):
|
||||||
return self.event_start.strftime("%b")
|
return self.event_start.strftime("%b")
|
||||||
@@ -247,6 +250,12 @@ class Event(Post):
|
|||||||
def event_start_day(self):
|
def event_start_day(self):
|
||||||
return self.event_start.strftime("%d")
|
return self.event_start.strftime("%d")
|
||||||
|
|
||||||
|
def clean(self):
|
||||||
|
if self.event_end is None or self.event_start is None:
|
||||||
|
raise ValidationError(_('Das Datum des Events fehlt.'))
|
||||||
|
elif self.event_end < self.event_start:
|
||||||
|
raise ValidationError(_('Das Ende des Events liegt vor dem Beginn.'))
|
||||||
|
|
||||||
def save(self, *args, **kwargs):
|
def save(self, *args, **kwargs):
|
||||||
self.is_event = True
|
self.is_event = True
|
||||||
|
|
||||||
@@ -266,6 +275,9 @@ class FetMeeting(Event):
|
|||||||
verbose_name_plural = "Fet Sitzungen"
|
verbose_name_plural = "Fet Sitzungen"
|
||||||
|
|
||||||
def clean(self):
|
def clean(self):
|
||||||
|
if self.event_start is None:
|
||||||
|
raise ValidationError(_('Das Datum des Events fehlt.'))
|
||||||
|
|
||||||
slug = slugify(self.event_start.date()) + "-" + slugify("Fachschaftssitzung")
|
slug = slugify(self.event_start.date()) + "-" + slugify("Fachschaftssitzung")
|
||||||
|
|
||||||
if Post.objects.filter(slug=slug).count() != 0:
|
if Post.objects.filter(slug=slug).count() != 0:
|
||||||
|
|||||||
Reference in New Issue
Block a user