Skip to content

Commit

Permalink
events: Add boolean field external to Event
Browse files Browse the repository at this point in the history
  • Loading branch information
donald committed Mar 26, 2021
1 parent c3cbe28 commit 706d786
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
18 changes: 18 additions & 0 deletions mpicms/events/migrations/0015_event_external.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.1.7 on 2021-03-21 11:49

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('events', '0014_auto_20210114_1926'),
]

operations = [
migrations.AddField(
model_name='event',
name='external',
field=models.BooleanField(default=False),
),
]
4 changes: 3 additions & 1 deletion mpicms/events/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Event(BodyMixin, BasePage):
start_time = models.TimeField(_('start time'), blank=True, null=True)
end_time = models.TimeField(_('end time'), blank=True, null=True)
room = models.CharField(_('Room'), max_length=10, blank=True)
external = models.BooleanField(default=False)

header_image = models.ForeignKey(
'wagtailimages.Image',
Expand All @@ -36,6 +37,7 @@ class Event(BodyMixin, BasePage):
ImageChooserPanel('header_image'),
MultiFieldPanel(
[
FieldPanel('external'),
FieldPanel('start_date'),
FieldPanel('start_time'),
FieldPanel('end_date'),
Expand Down Expand Up @@ -74,7 +76,7 @@ def get_dict(self, request=None):
'start': self.start.isoformat(),
'end': self.end.isoformat() if self.end else None,
'url': self.get_url(request=request),
'color': '#006c66'
'color': '#aa0000' if self.external else '#006c66'
}

def clean(self):
Expand Down

0 comments on commit 706d786

Please sign in to comment.