Commit 28b5f636 authored by Maxime Emschwiller's avatar Maxime Emschwiller
Browse files

feat(backend): Change model and add migration to include feedback type

parent 376ad23b
# Generated by Django 2.1.7 on 2020-06-14 12:09
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("backend_app", "0005_lastvisiteduniversity"),
("stats_app", "0002_auto_20200601_1418"),
]
operations = [
migrations.AddField(
model_name="dailyexchangecontributionsinfo",
name="type",
field=models.CharField(
choices=[
("exchange_feedback", "exchange_feedback"),
("course_feedback", "course_feedback"),
],
default="exchange_feedback",
max_length=20,
),
preserve_default=False,
),
migrations.AlterUniqueTogether(
name="dailyexchangecontributionsinfo",
unique_together={
("date", "type", "university", "major", "minor", "exchange_semester")
},
),
]
......@@ -10,6 +10,11 @@ class DailyConnections(models.Model):
class DailyExchangeContributionsInfo(models.Model):
date = models.DateTimeField(null=False)
TYPE_CHOICES = [
("exchange_feedback", "exchange_feedback"),
("course_feedback", "course_feedback"),
]
type = models.CharField(max_length=20, choices=TYPE_CHOICES, null=False)
university = models.ForeignKey(University, null=False, on_delete=models.CASCADE)
major = models.CharField(max_length=20, null=False, blank=True)
minor = models.CharField(max_length=47, null=False, blank=True)
......@@ -19,4 +24,11 @@ class DailyExchangeContributionsInfo(models.Model):
)
class Meta:
unique_together = ("date", "university", "major", "minor", "exchange_semester")
unique_together = (
"date",
"type",
"university",
"major",
"minor",
"exchange_semester",
)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment