Initializing Database
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
|
||||
from django.contrib import admin
|
||||
from .models import Classes
|
||||
from .models import Classes, Subject, Teacher
|
||||
|
||||
# Register your models here.
|
||||
admin.site.register(Classes)
|
||||
admin.site.register(Classes)
|
||||
admin.site.register(Subject)
|
||||
admin.site.register(Teacher)
|
||||
@@ -1,5 +1,6 @@
|
||||
# Generated by Django 5.0.1 on 2024-06-09 22:23
|
||||
# Generated by Django 5.0.6 on 2024-06-23 06:06
|
||||
|
||||
import django.db.models.deletion
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
@@ -11,6 +12,22 @@ class Migration(migrations.Migration):
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Subject',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('acronym', models.CharField(max_length=200)),
|
||||
('full_name', models.CharField(max_length=200)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Teacher',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('First_Name', models.CharField(max_length=200)),
|
||||
('Last_Name', models.CharField(max_length=200)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Classes',
|
||||
fields=[
|
||||
@@ -18,6 +35,9 @@ class Migration(migrations.Migration):
|
||||
('MJC_Class_Name', models.CharField(max_length=200)),
|
||||
('Common_Class_Name', models.CharField(max_length=200)),
|
||||
('MJC_Units', models.IntegerField()),
|
||||
('Section_Number', models.CharField(max_length=200)),
|
||||
('In_Subject', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='Subject', to='classes.subject')),
|
||||
('Instructor', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='Teacher', to='classes.teacher')),
|
||||
],
|
||||
),
|
||||
]
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
# Generated by Django 5.0.6 on 2024-06-23 06:10
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('classes', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='classes',
|
||||
name='Instructor',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='classes',
|
||||
name='Instructor',
|
||||
field=models.ManyToManyField(related_name='Teacher', to='classes.teacher'),
|
||||
),
|
||||
]
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
classes/migrations/__pycache__/0003_subject.cpython-310.pyc
Normal file
BIN
classes/migrations/__pycache__/0003_subject.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
BIN
classes/migrations/__pycache__/0005_teacher.cpython-310.pyc
Normal file
BIN
classes/migrations/__pycache__/0005_teacher.cpython-310.pyc
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,10 +1,28 @@
|
||||
from django.db import models
|
||||
|
||||
# Create your models here.
|
||||
|
||||
class Subject(models.Model):
|
||||
acronym = models.CharField(max_length=200)
|
||||
full_name = models.CharField(max_length=200)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.pk} {self.acronym}: {self.full_name}"
|
||||
|
||||
class Teacher(models.Model):
|
||||
First_Name = models.CharField(max_length=200)
|
||||
Last_Name = models.CharField(max_length=200)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return f"{self.pk} {self.Last_Name}, {self.First_Name}"
|
||||
|
||||
class Classes(models.Model):
|
||||
MJC_Class_Name = models.CharField(max_length=200)
|
||||
Common_Class_Name = models.CharField(max_length=200)
|
||||
MJC_Units = models.IntegerField()
|
||||
Section_Number = models.CharField(max_length=200)
|
||||
Instructor = models.ManyToManyField(Teacher, related_name="Teacher")
|
||||
In_Subject = models.ForeignKey(Subject, related_name="Subject", on_delete=models.DO_NOTHING)
|
||||
|
||||
def __str__(self) -> str:
|
||||
return self.MJC_Class_Name
|
||||
Reference in New Issue
Block a user