forked from rc/aircox
add middleware for aircox used for timezone and current station selection in admin; add page summary for today's diffusions menu in link title
This commit is contained in:
@ -167,6 +167,11 @@ class Station(Nameable):
|
||||
max_length = 256,
|
||||
blank = True,
|
||||
)
|
||||
default = models.BooleanField(
|
||||
_('default station'),
|
||||
default = True,
|
||||
help_text = _('if checked, this station is used as the main one')
|
||||
)
|
||||
|
||||
#
|
||||
# Controllers
|
||||
@ -333,6 +338,12 @@ class Station(Nameable):
|
||||
self.slug
|
||||
)
|
||||
|
||||
if self.default:
|
||||
qs = Station.objects.filter(default = True)
|
||||
if self.pk:
|
||||
qs = qs.exclude(pk = self.pk)
|
||||
qs.update(default = False)
|
||||
|
||||
super().save(*args, **kwargs)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user