Skip to content

Commit

Permalink
Added querystrings
Browse files Browse the repository at this point in the history
  • Loading branch information
nulzo committed Oct 28, 2023
1 parent 61092f6 commit d6e83aa
Show file tree
Hide file tree
Showing 11 changed files with 861 additions and 193 deletions.
7 changes: 3 additions & 4 deletions backend/base/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
# Section URLS
path(
"api/sections/",
view=routing.SectionListView.as_view(),
view=routing.APISectionList.as_view(),
name="Section List View",
),
# path("api/sections/<str:section_id>"),
Expand Down Expand Up @@ -156,10 +156,9 @@
# path("api/messages/inactive/"),
# path("api/messages/activate/<str:message_pk>"),
# Course URLS
path(
"api/courses/", view=routing.CourseListView.as_view(), name="Course List View"
),
path("api/courses/", view=routing.APICourseList.as_view(), name="Course List View"),
# path("api/courses/<str:course_pk>", view=routing.MessageViewSet.as_view()),
# path("api/courses/department/<str:dept>"),
# path("api/courses/active/"),
path("api/prof/", view=routing.APIProfessorList.as_view(), name="professor"),
]
10 changes: 9 additions & 1 deletion backend/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,12 @@ test-with-coverage:

.PHONY run:
run:
python manage.py runserver
python3 manage.py runserver

.PHONY migrate:
migrate:
python3 manage.py makemigrations && python3 manage.py migrate

.PHONY load_data:
load_data:
python3 manage.py runscript load_semester
471 changes: 471 additions & 0 deletions backend/src/api/data/semester_data.csv

Large diffs are not rendered by default.

36 changes: 15 additions & 21 deletions backend/src/api/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.2.6 on 2023-10-28 01:51
# Generated by Django 4.2.6 on 2023-10-28 19:03

import django.db.models.deletion
import django.db.models.manager
Expand All @@ -25,7 +25,8 @@ class Migration(migrations.Migration):
),
("course_department", models.CharField(default="CSCI", max_length=10)),
("course_name", models.CharField(max_length=100)),
("course_id", models.CharField(max_length=25)),
("course_id", models.IntegerField(max_length=10)),
("course_code", models.CharField(max_length=15, unique=True)),
],
),
migrations.CreateModel(
Expand Down Expand Up @@ -91,21 +92,17 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Professor",
fields=[
("first_name", models.CharField(max_length=30)),
("last_name", models.CharField(max_length=50)),
("full_name", models.CharField(max_length=80)),
("email", models.CharField(max_length=50)),
("is_active", models.BooleanField(default=True)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
"professor_id",
models.BigIntegerField(
max_length=30, primary_key=True, serialize=False, unique=True
),
),
("first_name", models.CharField(max_length=25)),
("last_name", models.CharField(max_length=30)),
("full_name", models.CharField(max_length=100)),
("email", models.CharField(max_length=100)),
("is_active", models.BooleanField(default=True)),
("professor_id", models.CharField(max_length=30, unique=True)),
],
managers=[
("professor", django.db.models.manager.Manager()),
Expand All @@ -114,16 +111,13 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name="Section",
fields=[
("modality", models.CharField(default="001", max_length=10)),
(
"id",
models.BigAutoField(
auto_created=True,
primary_key=True,
serialize=False,
verbose_name="ID",
"section_id",
models.BigIntegerField(
primary_key=True, serialize=False, unique=True
),
),
("modality", models.CharField(default="001", max_length=10)),
(
"course",
models.ForeignKey(
Expand Down
5 changes: 4 additions & 1 deletion backend/src/api/models/course.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@
class Course(models.Model):
course_department = models.CharField(max_length=10, blank=False, default="CSCI")
course_name = models.CharField(max_length=100, blank=False)
course_id = models.CharField(max_length=25, blank=False, null=False)
course_id = models.IntegerField(max_length=10, blank=False, null=False)
course_code = models.CharField(max_length=15, blank=False, null=False, unique=True)
# is_active = models.BooleanField(default=True, null=False)

generic = models.Manager()

def __str__(self):
return str(self.course_name)
12 changes: 6 additions & 6 deletions backend/src/api/models/professor.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ def get_professor(self, professor: str):


class Professor(models.Model):
first_name: str = models.CharField(max_length=25)
last_name: str = models.CharField(max_length=30)
full_name: str = models.CharField(max_length=100)
email: str = models.CharField(max_length=100)
first_name: str = models.CharField(max_length=30)
last_name: str = models.CharField(max_length=50)
full_name: str = models.CharField(max_length=80)
email: str = models.CharField(max_length=50)
is_active: str = models.BooleanField(default=True)
professor_id: str = models.CharField(
unique=True, max_length=30, null=False, blank=False
professor_id: str = models.BigIntegerField(
unique=True, max_length=30, null=False, blank=False, primary_key=True
)

professor = ProfessorManager()
Expand Down
4 changes: 4 additions & 0 deletions backend/src/api/models/sections.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,15 @@ class Section(models.Model):
"api.Professor", on_delete=models.PROTECT, null=True, blank=True
)
course = models.ForeignKey(Course, on_delete=models.PROTECT, null=True, blank=True)
section_id = models.BigIntegerField(
primary_key=True, unique=True, blank=False, null=False
)

online = OnlineSectionManager()
inperson = InPersonSectionManager()
hybrid = HybridSectionManager()
sections = SectionManager()
generic = models.Manager()

def __str__(self):
return f"{self.course}"
Expand Down
Loading

0 comments on commit d6e83aa

Please sign in to comment.