From 076b1fb9b58e0e767779d96fc0a92c932ca6a4ab Mon Sep 17 00:00:00 2001 From: avoyen Date: Wed, 28 Feb 2024 20:18:33 +0100 Subject: [PATCH] added a model for groups --- backend/pigeonhole/apps/groups/__init__.py | 0 backend/pigeonhole/apps/groups/models.py | 17 +++++++++++++++++ 2 files changed, 17 insertions(+) create mode 100644 backend/pigeonhole/apps/groups/__init__.py create mode 100644 backend/pigeonhole/apps/groups/models.py diff --git a/backend/pigeonhole/apps/groups/__init__.py b/backend/pigeonhole/apps/groups/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/backend/pigeonhole/apps/groups/models.py b/backend/pigeonhole/apps/groups/models.py new file mode 100644 index 00000000..87000674 --- /dev/null +++ b/backend/pigeonhole/apps/groups/models.py @@ -0,0 +1,17 @@ +from django.db import models +from rest_framework import serializers + +from backend.pigeonhole.apps.projects.models import Project + + +class Group(models.Model): + group_id = models.BigAutoField(primary_key=True) + group_nr = models.IntegerField() + final_score = models.IntegerField() + project_id = models.ForeignKey(Project, on_delete=models.CASCADE) + + +class GroupSerializer(serializers.ModelSerializer): + class Meta: + model = Group + fields = ["group_id", "group_nr", "final_score", "project_id"]