Added student_status model

This commit is contained in:
Keannu Christian Bernasol 2023-06-26 22:06:05 +08:00
parent 7762f72ce2
commit ed6a66e989
15 changed files with 143 additions and 13 deletions

View file

View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class StudentStatusConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'student_status'

View file

@ -0,0 +1,29 @@
# Generated by Django 4.2.2 on 2023-06-26 14:03
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('accounts', '0003_delete_studentstatus'),
]
operations = [
migrations.CreateModel(
name='StudentStatus',
fields=[
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, primary_key=True, serialize=False, to=settings.AUTH_USER_MODEL)),
('x_latitude', models.FloatField(null=True)),
('y_latitude', models.FloatField(null=True)),
('subject', models.CharField(max_length=100)),
('year_level', models.CharField(choices=[('1st', '1st year'), ('2nd', '2nd year'), ('3rd', '3rd year'), ('4th', '4th year'), ('5th', '5th Year'), ('Irreg', 'Irregular')], max_length=50)),
('semester', models.CharField(choices=[('1st', '1st semester'), ('2nd', '2nd semester')], max_length=50)),
('timestamp', models.DateField(auto_now_add=True)),
],
),
]

View file

@ -0,0 +1,28 @@
from django.db import models
from accounts.models import CustomUser
# Create your models here.
class StudentStatus(models.Model):
YEAR_LEVELS = (
('1st', '1st year'),
('2nd', '2nd year'),
('3rd', '3rd year'),
('4th', '4th year'),
('5th', '5th Year'),
('Irreg', 'Irregular'),
)
SEMESTERS = (
('1st', '1st semester'),
('2nd', '2nd semester'),
)
user = models.OneToOneField(
CustomUser, on_delete=models.CASCADE, primary_key=True)
x_latitude = models.FloatField(null=True)
y_latitude = models.FloatField(null=True)
subject = models.CharField(max_length=100)
year_level = models.CharField(
max_length=50, choices=CustomUser.YEAR_LEVELS)
semester = models.CharField(max_length=50, choices=CustomUser.SEMESTERS)
timestamp = models.DateField(auto_now_add=True)

View file

@ -0,0 +1,9 @@
from rest_framework import serializers
from student_status.models import StudentStatus
class StudentStatusSerializer(serializers.ModelSerializer):
class Meta:
model = StudentStatus
fields = ('x_latitude', 'y_latitude', 'subject',
'year_level', 'semester', 'timestamp')

View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

View file

@ -0,0 +1,3 @@
from django.shortcuts import render
# Create your views here.