mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2024-11-17 06:19:24 +08:00
Migrated location fields to new format. Also fixed student_status serializer
This commit is contained in:
parent
14d99fc7c2
commit
98177f7235
23 changed files with 69 additions and 221 deletions
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
import accounts.models
|
import accounts.models
|
||||||
import django.contrib.auth.models
|
import django.contrib.auth.models
|
||||||
|
@ -25,10 +25,10 @@ class Migration(migrations.Migration):
|
||||||
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
('username', models.CharField(error_messages={'unique': 'A user with that username already exists.'}, help_text='Required. 150 characters or fewer. Letters, digits and @/./+/-/_ only.', max_length=150, unique=True, validators=[django.contrib.auth.validators.UnicodeUsernameValidator()], verbose_name='username')),
|
||||||
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
('email', models.EmailField(blank=True, max_length=254, verbose_name='email address')),
|
||||||
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
('is_staff', models.BooleanField(default=False, help_text='Designates whether the user can log into this admin site.', verbose_name='staff status')),
|
||||||
('is_active', models.BooleanField(default=True, help_text='Designates whether this user should be treated as active. Unselect this instead of deleting accounts.', verbose_name='active')),
|
|
||||||
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
('date_joined', models.DateTimeField(default=django.utils.timezone.now, verbose_name='date joined')),
|
||||||
('first_name', models.CharField(max_length=100)),
|
('first_name', models.CharField(max_length=100)),
|
||||||
('last_name', models.CharField(max_length=100)),
|
('last_name', models.CharField(max_length=100)),
|
||||||
|
('is_active', models.BooleanField(default=False)),
|
||||||
('is_student', models.BooleanField(default=True)),
|
('is_student', models.BooleanField(default=True)),
|
||||||
('is_studying', models.BooleanField(default=False)),
|
('is_studying', models.BooleanField(default=False)),
|
||||||
('is_banned', models.BooleanField(default=False)),
|
('is_banned', models.BooleanField(default=False)),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -9,18 +9,19 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('auth', '0012_alter_user_first_name_max_length'),
|
|
||||||
('year_levels', '0001_initial'),
|
|
||||||
('accounts', '0001_initial'),
|
|
||||||
('courses', '0002_initial'),
|
('courses', '0002_initial'),
|
||||||
|
('accounts', '0001_initial'),
|
||||||
('semesters', '0001_initial'),
|
('semesters', '0001_initial'),
|
||||||
|
('year_levels', '0001_initial'),
|
||||||
|
('auth', '0012_alter_user_first_name_max_length'),
|
||||||
|
('subjects', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='customuser',
|
model_name='customuser',
|
||||||
name='course',
|
name='course',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='courses.course'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='courses.course'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='customuser',
|
model_name='customuser',
|
||||||
|
@ -30,7 +31,12 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='customuser',
|
model_name='customuser',
|
||||||
name='semester',
|
name='semester',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='semesters.semester'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='semesters.semester'),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='customuser',
|
||||||
|
name='subjects',
|
||||||
|
field=models.ManyToManyField(related_name='SubjectStudent_user', through='subjects.SubjectStudent', to='subjects.subject'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='customuser',
|
model_name='customuser',
|
||||||
|
@ -40,6 +46,6 @@ class Migration(migrations.Migration):
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='customuser',
|
model_name='customuser',
|
||||||
name='year_level',
|
name='year_level',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='year_levels.year_level'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='year_levels.year_level'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-28 03:09
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('subjects', '0002_subjectstudent_subject_students'),
|
|
||||||
('accounts', '0002_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='customuser',
|
|
||||||
name='subjects',
|
|
||||||
field=models.ManyToManyField(related_name='SubjectStudent_user', through='subjects.SubjectStudent', to='subjects.subject'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,32 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-07-04 10:04
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('semesters', '0001_initial'),
|
|
||||||
('courses', '0002_initial'),
|
|
||||||
('year_levels', '0001_initial'),
|
|
||||||
('accounts', '0003_customuser_subjects'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='customuser',
|
|
||||||
name='course',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='courses.course'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='customuser',
|
|
||||||
name='semester',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='semesters.semester'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='customuser',
|
|
||||||
name='year_level',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='year_levels.year_level'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-07-04 11:33
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('accounts', '0004_alter_customuser_course_alter_customuser_semester_and_more'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='customuser',
|
|
||||||
name='is_active',
|
|
||||||
field=models.BooleanField(default=False),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -11,6 +11,7 @@ from django.contrib.auth.password_validation import validate_password
|
||||||
from courses.models import Course
|
from courses.models import Course
|
||||||
from year_levels.models import Year_Level
|
from year_levels.models import Year_Level
|
||||||
from semesters.models import Semester
|
from semesters.models import Semester
|
||||||
|
from django.contrib.gis.geos import Point
|
||||||
|
|
||||||
|
|
||||||
class CustomUserSerializer(BaseUserSerializer):
|
class CustomUserSerializer(BaseUserSerializer):
|
||||||
|
@ -35,7 +36,8 @@ class CustomUserSerializer(BaseUserSerializer):
|
||||||
class UserRegistrationSerializer(serializers.ModelSerializer):
|
class UserRegistrationSerializer(serializers.ModelSerializer):
|
||||||
email = serializers.EmailField(required=True)
|
email = serializers.EmailField(required=True)
|
||||||
student_id_number = serializers.CharField(required=True)
|
student_id_number = serializers.CharField(required=True)
|
||||||
password = serializers.CharField(write_only=True)
|
password = serializers.CharField(
|
||||||
|
write_only=True, style={'input_type': 'password', 'placeholder': 'Password'})
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = CustomUser # Use your custom user model here
|
model = CustomUser # Use your custom user model here
|
||||||
|
@ -64,8 +66,7 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
|
||||||
StudentStatus.objects.create(
|
StudentStatus.objects.create(
|
||||||
user=user,
|
user=user,
|
||||||
active=False,
|
active=False,
|
||||||
x=None,
|
location=Point(0, 0),
|
||||||
y=None,
|
|
||||||
subject=None
|
subject=None
|
||||||
)
|
)
|
||||||
return user
|
return user
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -9,8 +9,8 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('subjects', '0001_initial'),
|
|
||||||
('courses', '0001_initial'),
|
('courses', '0001_initial'),
|
||||||
|
('subjects', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
|
import django.contrib.gis.db.models.fields
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -18,8 +19,7 @@ class Migration(migrations.Migration):
|
||||||
name='StudentStatus',
|
name='StudentStatus',
|
||||||
fields=[
|
fields=[
|
||||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
|
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
|
||||||
('x', models.FloatField(null=True)),
|
('location', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)),
|
||||||
('y', models.FloatField(null=True)),
|
|
||||||
('active', models.BooleanField(default=False)),
|
('active', models.BooleanField(default=False)),
|
||||||
('timestamp', models.DateField(auto_now_add=True)),
|
('timestamp', models.DateField(auto_now_add=True)),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
@ -10,19 +10,19 @@ class Migration(migrations.Migration):
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('student_status', '0001_initial'),
|
('student_status', '0001_initial'),
|
||||||
('subjects', '0001_initial'),
|
|
||||||
('study_groups', '0001_initial'),
|
('study_groups', '0001_initial'),
|
||||||
|
('subjects', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='studentstatus',
|
model_name='studentstatus',
|
||||||
name='study_group',
|
name='study_group',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='study_groups.studygroup'),
|
field=models.ManyToManyField(blank=True, through='study_groups.StudyGroupMembership', to='study_groups.studygroup'),
|
||||||
),
|
),
|
||||||
migrations.AddField(
|
migrations.AddField(
|
||||||
model_name='studentstatus',
|
model_name='studentstatus',
|
||||||
name='subject',
|
name='subject',
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='subjects.subject'),
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='subjects.subject'),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,23 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:53
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('study_groups', '0001_initial'),
|
|
||||||
('student_status', '0002_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RemoveField(
|
|
||||||
model_name='studentstatus',
|
|
||||||
name='study_group',
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='studentstatus',
|
|
||||||
name='study_group',
|
|
||||||
field=models.ManyToManyField(blank=True, null=True, through='study_groups.StudyGroupMembership', to='study_groups.studygroup'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 17:15
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('study_groups', '0001_initial'),
|
|
||||||
('student_status', '0003_remove_studentstatus_study_group_and_more'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studentstatus',
|
|
||||||
name='study_group',
|
|
||||||
field=models.ManyToManyField(blank=True, through='study_groups.StudyGroupMembership', to='study_groups.studygroup'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,20 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-07-04 10:01
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('subjects', '0002_subjectstudent_subject_students'),
|
|
||||||
('student_status', '0004_alter_studentstatus_study_group'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='studentstatus',
|
|
||||||
name='subject',
|
|
||||||
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='subjects.subject'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,15 +1,15 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from accounts.models import CustomUser
|
from accounts.models import CustomUser
|
||||||
from study_groups.models import StudyGroup
|
from study_groups.models import StudyGroup
|
||||||
|
from django.contrib.gis.db import models as gis_models
|
||||||
|
from django.contrib.gis.geos import Point
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
class StudentStatus(models.Model):
|
class StudentStatus(models.Model):
|
||||||
user = models.OneToOneField(
|
user = models.OneToOneField(
|
||||||
CustomUser, on_delete=models.CASCADE, primary_key=True)
|
CustomUser, on_delete=models.CASCADE, primary_key=True)
|
||||||
x = models.FloatField(null=True)
|
location = gis_models.PointField(blank=True, null=True)
|
||||||
y = models.FloatField(null=True)
|
|
||||||
subject = models.ForeignKey(
|
subject = models.ForeignKey(
|
||||||
'subjects.Subject', on_delete=models.SET_NULL, null=True)
|
'subjects.Subject', on_delete=models.SET_NULL, null=True)
|
||||||
active = models.BooleanField(default=False)
|
active = models.BooleanField(default=False)
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
from rest_framework import serializers
|
from rest_framework import serializers
|
||||||
from .models import StudentStatus
|
from .models import StudentStatus
|
||||||
|
from subjects.models import Subject
|
||||||
|
from django.contrib.gis.geos import Point
|
||||||
|
|
||||||
|
|
||||||
class StudentStatusSerializer(serializers.ModelSerializer):
|
class StudentStatusSerializer(serializers.ModelSerializer):
|
||||||
year_level = serializers.CharField(
|
subject = serializers.SlugRelatedField(
|
||||||
source='user.year_level', read_only=True)
|
queryset=Subject.objects.all(), slug_field='name', required=True)
|
||||||
course = serializers.CharField(source='user.course', read_only=True)
|
|
||||||
semester = serializers.CharField(source='user.semester', read_only=True)
|
|
||||||
user = serializers.CharField(source='user.full_name', read_only=True)
|
user = serializers.CharField(source='user.full_name', read_only=True)
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -24,8 +24,7 @@ class StudentStatusSerializer(serializers.ModelSerializer):
|
||||||
active = validated_data.get('active', None)
|
active = validated_data.get('active', None)
|
||||||
|
|
||||||
if active is not None and active is False:
|
if active is not None and active is False:
|
||||||
validated_data['x'] = None
|
validated_data['location'] = Point(0, 0)
|
||||||
validated_data['y'] = None
|
|
||||||
validated_data['subject'] = None
|
validated_data['subject'] = None
|
||||||
|
|
||||||
return super().update(instance, validated_data)
|
return super().update(instance, validated_data)
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
|
import django.contrib.gis.db.models.fields
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -19,8 +20,7 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('name', models.CharField(max_length=48)),
|
('name', models.CharField(max_length=48)),
|
||||||
('x', models.FloatField(null=True)),
|
('location', django.contrib.gis.db.models.fields.PointField(blank=True, null=True, srid=4326)),
|
||||||
('y', models.FloatField(null=True)),
|
|
||||||
('active', models.BooleanField(default=False)),
|
('active', models.BooleanField(default=False)),
|
||||||
('timestamp', models.DateField(auto_now_add=True)),
|
('timestamp', models.DateField(auto_now_add=True)),
|
||||||
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.subject')),
|
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.subject')),
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
from django.db import models
|
from django.db import models
|
||||||
from subjects.models import Subject
|
from subjects.models import Subject
|
||||||
|
from django.contrib.gis.db import models as gis_models
|
||||||
|
from django.contrib.gis.geos import Point
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
|
|
||||||
|
@ -7,8 +9,7 @@ class StudyGroup(models.Model):
|
||||||
name = models.CharField(max_length=48)
|
name = models.CharField(max_length=48)
|
||||||
users = models.ManyToManyField(
|
users = models.ManyToManyField(
|
||||||
'student_status.StudentStatus', through='StudyGroupMembership')
|
'student_status.StudentStatus', through='StudyGroupMembership')
|
||||||
x = models.FloatField(null=True)
|
location = gis_models.PointField(blank=True, null=True)
|
||||||
y = models.FloatField(null=True)
|
|
||||||
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
|
subject = models.ForeignKey(Subject, on_delete=models.CASCADE)
|
||||||
active = models.BooleanField(default=False)
|
active = models.BooleanField(default=False)
|
||||||
timestamp = models.DateField(auto_now_add=True)
|
timestamp = models.DateField(auto_now_add=True)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:24
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
@ -20,7 +20,7 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('message_content', models.TextField(max_length=1024)),
|
('message_content', models.TextField(max_length=1024)),
|
||||||
('timestamp', models.DateField(auto_now_add=True)),
|
('timestamp', models.DateTimeField(auto_now_add=True)),
|
||||||
('study_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='study_groups.studygroup')),
|
('study_group', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='study_groups.studygroup')),
|
||||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
],
|
],
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 17:15
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('studygroup_messages', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='message',
|
|
||||||
name='timestamp',
|
|
||||||
field=models.DateTimeField(auto_now_add=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -9,9 +10,10 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
('semesters', '0001_initial'),
|
('semesters', '0001_initial'),
|
||||||
('year_levels', '0001_initial'),
|
|
||||||
('courses', '0001_initial'),
|
('courses', '0001_initial'),
|
||||||
|
('year_levels', '0001_initial'),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
||||||
|
@ -23,7 +25,24 @@ class Migration(migrations.Migration):
|
||||||
('code', models.CharField(max_length=16)),
|
('code', models.CharField(max_length=16)),
|
||||||
('courses', models.ManyToManyField(related_name='SubjectCourse_subject', through='courses.SubjectCourse', to='courses.course')),
|
('courses', models.ManyToManyField(related_name='SubjectCourse_subject', through='courses.SubjectCourse', to='courses.course')),
|
||||||
('semester', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='semesters.semester')),
|
('semester', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, to='semesters.semester')),
|
||||||
('year_level', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='Year_Level_name', to='year_levels.year_level')),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
migrations.CreateModel(
|
||||||
|
name='SubjectStudent',
|
||||||
|
fields=[
|
||||||
|
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.subject')),
|
||||||
|
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='subject',
|
||||||
|
name='students',
|
||||||
|
field=models.ManyToManyField(related_name='SubjectStudent_subject', through='subjects.SubjectStudent', to=settings.AUTH_USER_MODEL),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='subject',
|
||||||
|
name='year_level',
|
||||||
|
field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='Year_Level_name', to='year_levels.year_level'),
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,29 +0,0 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-28 03:09
|
|
||||||
|
|
||||||
from django.conf import settings
|
|
||||||
from django.db import migrations, models
|
|
||||||
import django.db.models.deletion
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
('subjects', '0001_initial'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.CreateModel(
|
|
||||||
name='SubjectStudent',
|
|
||||||
fields=[
|
|
||||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
|
||||||
('subject', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='subjects.subject')),
|
|
||||||
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
|
||||||
],
|
|
||||||
),
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='subject',
|
|
||||||
name='students',
|
|
||||||
field=models.ManyToManyField(related_name='SubjectStudent_subject', through='subjects.SubjectStudent', to=settings.AUTH_USER_MODEL),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
# Generated by Django 4.2.3 on 2023-07-09 10:57
|
||||||
|
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue