Skip to content

Commit

Permalink
fix(announcement): use char instead of integer for announcement_type
Browse files Browse the repository at this point in the history
  • Loading branch information
esinx committed Oct 26, 2023
1 parent faea762 commit 8938faf
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Generated by Django 3.2.21 on 2023-10-26 18:28

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('announcements', '0001_initial'),
]

operations = [
migrations.AlterField(
model_name='announcement',
name='announcement_type',
field=models.CharField(choices=[('NOTICE', 'Notice'), ('ISSUE', 'Issue')], default='NOTICE', max_length=20),
),
]
13 changes: 7 additions & 6 deletions backend/announcements/models.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from django.db import models


class Audience(models.Model):
"""
Represents a product that an announcement is intended for.
Expand All @@ -26,19 +27,18 @@ class Audience(models.Model):
def __str__(self):
return self.name


class Announcement(models.Model):
"""
Represents an announcement for any of the Penn Labs services.
"""

ANNOUNCEMENT_BANNER = 1
ANNOUNCEMENT_ISSUE = 2
ANNOUNCEMENT_NOTICE = 3
ANNOUNCEMENT_NOTICE = "NOTICE"
ANNOUNCEMENT_ISSUE = "ISSUE"

ANNOUNCEMENT_CHOICES = [
(ANNOUNCEMENT_BANNER, "Banner"),
(ANNOUNCEMENT_ISSUE, "Issue"),
(ANNOUNCEMENT_NOTICE, "Notice"),
(ANNOUNCEMENT_ISSUE, "Issue"),
]

title = models.CharField(
Expand All @@ -47,7 +47,8 @@ class Announcement(models.Model):
null=True,
)
message = models.TextField()
announcement_type = models.IntegerField(
announcement_type = models.CharField(
max_length=20,
choices=ANNOUNCEMENT_CHOICES,
default=ANNOUNCEMENT_NOTICE,
)
Expand Down

0 comments on commit 8938faf

Please sign in to comment.