diff --git a/ClassSearch/__pycache__/__init__.cpython-310.pyc b/ClassSearch/__pycache__/__init__.cpython-310.pyc index 5f22230..d4bac21 100644 Binary files a/ClassSearch/__pycache__/__init__.cpython-310.pyc and b/ClassSearch/__pycache__/__init__.cpython-310.pyc differ diff --git a/ClassSearch/__pycache__/settings.cpython-310.pyc b/ClassSearch/__pycache__/settings.cpython-310.pyc index 3354b5a..eb57bbc 100644 Binary files a/ClassSearch/__pycache__/settings.cpython-310.pyc and b/ClassSearch/__pycache__/settings.cpython-310.pyc differ diff --git a/ClassSearch/__pycache__/urls.cpython-310.pyc b/ClassSearch/__pycache__/urls.cpython-310.pyc index 69819da..f68b8ab 100644 Binary files a/ClassSearch/__pycache__/urls.cpython-310.pyc and b/ClassSearch/__pycache__/urls.cpython-310.pyc differ diff --git a/ClassSearch/__pycache__/wsgi.cpython-310.pyc b/ClassSearch/__pycache__/wsgi.cpython-310.pyc index 13334c6..2bb6c79 100644 Binary files a/ClassSearch/__pycache__/wsgi.cpython-310.pyc and b/ClassSearch/__pycache__/wsgi.cpython-310.pyc differ diff --git a/api/__pycache__/__init__.cpython-310.pyc b/api/__pycache__/__init__.cpython-310.pyc index 4cb42ba..d0e0233 100644 Binary files a/api/__pycache__/__init__.cpython-310.pyc and b/api/__pycache__/__init__.cpython-310.pyc differ diff --git a/api/__pycache__/admin.cpython-310.pyc b/api/__pycache__/admin.cpython-310.pyc index 83f92cb..4010cfe 100644 Binary files a/api/__pycache__/admin.cpython-310.pyc and b/api/__pycache__/admin.cpython-310.pyc differ diff --git a/api/__pycache__/apps.cpython-310.pyc b/api/__pycache__/apps.cpython-310.pyc index 87bcc2c..47c45b7 100644 Binary files a/api/__pycache__/apps.cpython-310.pyc and b/api/__pycache__/apps.cpython-310.pyc differ diff --git a/api/__pycache__/models.cpython-310.pyc b/api/__pycache__/models.cpython-310.pyc index 0b57d4e..2d04664 100644 Binary files a/api/__pycache__/models.cpython-310.pyc and b/api/__pycache__/models.cpython-310.pyc differ diff --git a/api/migrations/__pycache__/__init__.cpython-310.pyc b/api/migrations/__pycache__/__init__.cpython-310.pyc index 981e68f..3435aa9 100644 Binary files a/api/migrations/__pycache__/__init__.cpython-310.pyc and b/api/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/classes/__pycache__/__init__.cpython-310.pyc b/classes/__pycache__/__init__.cpython-310.pyc index 637457b..ff5f726 100644 Binary files a/classes/__pycache__/__init__.cpython-310.pyc and b/classes/__pycache__/__init__.cpython-310.pyc differ diff --git a/classes/__pycache__/admin.cpython-310.pyc b/classes/__pycache__/admin.cpython-310.pyc index a6556da..fc494f5 100644 Binary files a/classes/__pycache__/admin.cpython-310.pyc and b/classes/__pycache__/admin.cpython-310.pyc differ diff --git a/classes/__pycache__/apps.cpython-310.pyc b/classes/__pycache__/apps.cpython-310.pyc index 2facffa..fec778b 100644 Binary files a/classes/__pycache__/apps.cpython-310.pyc and b/classes/__pycache__/apps.cpython-310.pyc differ diff --git a/classes/__pycache__/models.cpython-310.pyc b/classes/__pycache__/models.cpython-310.pyc index a7a667b..8361b7a 100644 Binary files a/classes/__pycache__/models.cpython-310.pyc and b/classes/__pycache__/models.cpython-310.pyc differ diff --git a/classes/__pycache__/serializers.cpython-310.pyc b/classes/__pycache__/serializers.cpython-310.pyc index 173c126..ff5a357 100644 Binary files a/classes/__pycache__/serializers.cpython-310.pyc and b/classes/__pycache__/serializers.cpython-310.pyc differ diff --git a/classes/__pycache__/urls.cpython-310.pyc b/classes/__pycache__/urls.cpython-310.pyc index 28b3ab3..1eaed11 100644 Binary files a/classes/__pycache__/urls.cpython-310.pyc and b/classes/__pycache__/urls.cpython-310.pyc differ diff --git a/classes/__pycache__/views.cpython-310.pyc b/classes/__pycache__/views.cpython-310.pyc index 5a7d90f..dd1deb0 100644 Binary files a/classes/__pycache__/views.cpython-310.pyc and b/classes/__pycache__/views.cpython-310.pyc differ diff --git a/classes/migrations/__pycache__/0001_initial.cpython-310.pyc b/classes/migrations/__pycache__/0001_initial.cpython-310.pyc index 3942628..c9ed362 100644 Binary files a/classes/migrations/__pycache__/0001_initial.cpython-310.pyc and b/classes/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/classes/migrations/__pycache__/__init__.cpython-310.pyc b/classes/migrations/__pycache__/__init__.cpython-310.pyc index e1ae1d1..1dcf509 100644 Binary files a/classes/migrations/__pycache__/__init__.cpython-310.pyc and b/classes/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/db.sqlite3 b/db.sqlite3 index 7bde693..eabade8 100644 Binary files a/db.sqlite3 and b/db.sqlite3 differ diff --git a/student/__pycache__/__init__.cpython-310.pyc b/student/__pycache__/__init__.cpython-310.pyc index 8ec391f..4247aaa 100644 Binary files a/student/__pycache__/__init__.cpython-310.pyc and b/student/__pycache__/__init__.cpython-310.pyc differ diff --git a/student/__pycache__/admin.cpython-310.pyc b/student/__pycache__/admin.cpython-310.pyc index cd28a14..cd589ce 100644 Binary files a/student/__pycache__/admin.cpython-310.pyc and b/student/__pycache__/admin.cpython-310.pyc differ diff --git a/student/__pycache__/apps.cpython-310.pyc b/student/__pycache__/apps.cpython-310.pyc index b7deeb4..9709683 100644 Binary files a/student/__pycache__/apps.cpython-310.pyc and b/student/__pycache__/apps.cpython-310.pyc differ diff --git a/student/__pycache__/models.cpython-310.pyc b/student/__pycache__/models.cpython-310.pyc index b0aa741..23b8a88 100644 Binary files a/student/__pycache__/models.cpython-310.pyc and b/student/__pycache__/models.cpython-310.pyc differ diff --git a/student/__pycache__/serializers.cpython-310.pyc b/student/__pycache__/serializers.cpython-310.pyc index d770135..67007f7 100644 Binary files a/student/__pycache__/serializers.cpython-310.pyc and b/student/__pycache__/serializers.cpython-310.pyc differ diff --git a/student/__pycache__/urls.cpython-310.pyc b/student/__pycache__/urls.cpython-310.pyc index 2b7aa42..5e50c92 100644 Binary files a/student/__pycache__/urls.cpython-310.pyc and b/student/__pycache__/urls.cpython-310.pyc differ diff --git a/student/__pycache__/views.cpython-310.pyc b/student/__pycache__/views.cpython-310.pyc index 2ddef17..93e3676 100644 Binary files a/student/__pycache__/views.cpython-310.pyc and b/student/__pycache__/views.cpython-310.pyc differ diff --git a/student/migrations/__pycache__/0001_initial.cpython-310.pyc b/student/migrations/__pycache__/0001_initial.cpython-310.pyc index db5bdc2..7992896 100644 Binary files a/student/migrations/__pycache__/0001_initial.cpython-310.pyc and b/student/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/student/migrations/__pycache__/0002_remove_student_classes_student_classes.cpython-310.pyc b/student/migrations/__pycache__/0002_remove_student_classes_student_classes.cpython-310.pyc index e70f22b..56c2b0e 100644 Binary files a/student/migrations/__pycache__/0002_remove_student_classes_student_classes.cpython-310.pyc and b/student/migrations/__pycache__/0002_remove_student_classes_student_classes.cpython-310.pyc differ diff --git a/student/migrations/__pycache__/__init__.cpython-310.pyc b/student/migrations/__pycache__/__init__.cpython-310.pyc index 9a4ef23..5263f8e 100644 Binary files a/student/migrations/__pycache__/__init__.cpython-310.pyc and b/student/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/university/__pycache__/__init__.cpython-310.pyc b/university/__pycache__/__init__.cpython-310.pyc index 286320f..f206977 100644 Binary files a/university/__pycache__/__init__.cpython-310.pyc and b/university/__pycache__/__init__.cpython-310.pyc differ diff --git a/university/__pycache__/admin.cpython-310.pyc b/university/__pycache__/admin.cpython-310.pyc index 57e6810..b87efd5 100644 Binary files a/university/__pycache__/admin.cpython-310.pyc and b/university/__pycache__/admin.cpython-310.pyc differ diff --git a/university/__pycache__/apps.cpython-310.pyc b/university/__pycache__/apps.cpython-310.pyc index 4dba8bc..82cdc0d 100644 Binary files a/university/__pycache__/apps.cpython-310.pyc and b/university/__pycache__/apps.cpython-310.pyc differ diff --git a/university/__pycache__/models.cpython-310.pyc b/university/__pycache__/models.cpython-310.pyc index 7a7d739..36272f1 100644 Binary files a/university/__pycache__/models.cpython-310.pyc and b/university/__pycache__/models.cpython-310.pyc differ diff --git a/university/__pycache__/serializers.cpython-310.pyc b/university/__pycache__/serializers.cpython-310.pyc index 28c687a..5a52583 100644 Binary files a/university/__pycache__/serializers.cpython-310.pyc and b/university/__pycache__/serializers.cpython-310.pyc differ diff --git a/university/__pycache__/urls.cpython-310.pyc b/university/__pycache__/urls.cpython-310.pyc index 071bba6..a3dafdb 100644 Binary files a/university/__pycache__/urls.cpython-310.pyc and b/university/__pycache__/urls.cpython-310.pyc differ diff --git a/university/__pycache__/views.cpython-310.pyc b/university/__pycache__/views.cpython-310.pyc index 2a27c43..151fd3d 100644 Binary files a/university/__pycache__/views.cpython-310.pyc and b/university/__pycache__/views.cpython-310.pyc differ diff --git a/university/migrations/0004_remove_agreement_sections_and_more.py b/university/migrations/0004_remove_agreement_sections_and_more.py new file mode 100644 index 0000000..8793447 --- /dev/null +++ b/university/migrations/0004_remove_agreement_sections_and_more.py @@ -0,0 +1,34 @@ +# Generated by Django 5.0.6 on 2024-06-18 21:20 + +import django.db.models.deletion +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('university', '0003_section_number_of_required_courses'), + ] + + operations = [ + migrations.RemoveField( + model_name='agreement', + name='sections', + ), + migrations.RemoveField( + model_name='university', + name='agreements', + ), + migrations.AddField( + model_name='agreement', + name='university', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='university.university'), + preserve_default=False, + ), + migrations.AddField( + model_name='section', + name='agreement', + field=models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, to='university.agreement'), + preserve_default=False, + ), + ] diff --git a/university/migrations/__pycache__/0001_initial.cpython-310.pyc b/university/migrations/__pycache__/0001_initial.cpython-310.pyc index dfe8c7b..8e132d6 100644 Binary files a/university/migrations/__pycache__/0001_initial.cpython-310.pyc and b/university/migrations/__pycache__/0001_initial.cpython-310.pyc differ diff --git a/university/migrations/__pycache__/0002_rename_agreements_agreement_rename_sections_section.cpython-310.pyc b/university/migrations/__pycache__/0002_rename_agreements_agreement_rename_sections_section.cpython-310.pyc index 15a662a..8efd9a1 100644 Binary files a/university/migrations/__pycache__/0002_rename_agreements_agreement_rename_sections_section.cpython-310.pyc and b/university/migrations/__pycache__/0002_rename_agreements_agreement_rename_sections_section.cpython-310.pyc differ diff --git a/university/migrations/__pycache__/0003_section_number_of_required_courses.cpython-310.pyc b/university/migrations/__pycache__/0003_section_number_of_required_courses.cpython-310.pyc index 4360ddb..197ca2a 100644 Binary files a/university/migrations/__pycache__/0003_section_number_of_required_courses.cpython-310.pyc and b/university/migrations/__pycache__/0003_section_number_of_required_courses.cpython-310.pyc differ diff --git a/university/migrations/__pycache__/0004_remove_agreement_sections_and_more.cpython-310.pyc b/university/migrations/__pycache__/0004_remove_agreement_sections_and_more.cpython-310.pyc new file mode 100644 index 0000000..43c58c5 Binary files /dev/null and b/university/migrations/__pycache__/0004_remove_agreement_sections_and_more.cpython-310.pyc differ diff --git a/university/migrations/__pycache__/__init__.cpython-310.pyc b/university/migrations/__pycache__/__init__.cpython-310.pyc index cdea3f8..9166133 100644 Binary files a/university/migrations/__pycache__/__init__.cpython-310.pyc and b/university/migrations/__pycache__/__init__.cpython-310.pyc differ diff --git a/university/models.py b/university/models.py index ec38644..5dc7597 100644 --- a/university/models.py +++ b/university/models.py @@ -1,25 +1,27 @@ from django.db import models from classes.models import Classes + + +# Create your models here. +class University(models.Model): + name = models.CharField(max_length=200) + + def __str__(self) -> str: + return self.name + +class Agreement(models.Model): + major = models.CharField(max_length=200) + university = models.ForeignKey(University, on_delete=models.CASCADE) + + def __str__(self) -> str: + return self.major + class Section(models.Model): area_name = models.CharField(max_length=200) number_of_required_courses = models.IntegerField() classes = models.ManyToManyField(Classes) + agreement = models.ForeignKey(Agreement, on_delete=models.CASCADE) def __str__(self) -> str: - return self.area_name - -class Agreement(models.Model): - major = models.CharField(max_length=200) - sections = models.ManyToManyField(Section) - - def __str__(self) -> str: - return self.major - -# Create your models here. -class University(models.Model): - name = models.CharField(max_length=200) - agreements = models.ManyToManyField(Agreement) - - def __str__(self) -> str: - return self.name \ No newline at end of file + return self.area_name \ No newline at end of file diff --git a/university/serializers.py b/university/serializers.py index 11d6f58..053fb90 100644 --- a/university/serializers.py +++ b/university/serializers.py @@ -2,28 +2,22 @@ from rest_framework import serializers from .models import University, Agreement, Section class UniversitySerializer(serializers.ModelSerializer): - - agreements = serializers.SlugRelatedField( - many = True, - read_only = True, - slug_field="major" - ) - + class Meta: model = University - fields = ["name", "agreements"] + fields = ["name"] class AgreementsSerializer(serializers.ModelSerializer): - sections = serializers.SlugRelatedField( - many = True, - read_only = True, - slug_field = "area_name" - ) + # sections = serializers.SlugRelatedField( + # many = True, + # read_only = True, + # slug_field = "area_name" + # ) class Meta: model = Agreement - fields = ["major", "sections"] + fields = ["major", "university"] class SectionsSerializer(serializers.ModelSerializer): @@ -35,4 +29,4 @@ class SectionsSerializer(serializers.ModelSerializer): class Meta: model = Section - fields = ["area_name", "number_of_required_courses", "classes"] \ No newline at end of file + fields = ["area_name", "number_of_required_courses", "classes", "agreement"] \ No newline at end of file