mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-03 20:20:18 -04:00
Fixed some files that broke over merge
This commit is contained in:
parent
8ae5958bbc
commit
b8c17561a3
4
.gitignore
vendored
4
.gitignore
vendored
|
@ -60,6 +60,10 @@ coverage.xml
|
|||
local_settings.py
|
||||
db.sqlite3
|
||||
db.sqlite3-journal
|
||||
migrations/
|
||||
*/migrations/
|
||||
**/**/migrations
|
||||
**/migrations
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-14 23:00
|
||||
# Generated by Django 3.0.7 on 2020-06-15 21:54
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
|
@ -23,8 +23,6 @@ class Migration(migrations.Migration):
|
|||
('path', models.CharField(default='', max_length=100)),
|
||||
('assignments', models.TextField(blank=True, default='')),
|
||||
('default_file', models.CharField(blank=True, default='', max_length=100)),
|
||||
('confirmed', models.TextField(blank=True, default='')),
|
||||
('unconfirmed', models.TextField(blank=True, default='')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
|
@ -42,8 +40,9 @@ class Migration(migrations.Migration):
|
|||
name='Teacher',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ion_user', models.CharField(max_length=100)),
|
||||
('git', models.CharField(blank=True, default='', max_length=100)),
|
||||
('classes', models.ManyToManyField(to='api.Class')),
|
||||
('classes', models.ManyToManyField(blank=True, related_name='classes', to='api.Class')),
|
||||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
|
@ -51,6 +50,7 @@ class Migration(migrations.Migration):
|
|||
name='Student',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('ion_user', models.CharField(max_length=100)),
|
||||
('grade', models.IntegerField(blank=True, default=0)),
|
||||
('git', models.CharField(blank=True, default='', max_length=100)),
|
||||
('repo', models.URLField(blank=True, default='')),
|
||||
|
@ -60,6 +60,16 @@ class Migration(migrations.Migration):
|
|||
('user', models.OneToOneField(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='class',
|
||||
name='confirmed',
|
||||
field=models.ManyToManyField(blank=True, related_name='confirmed', to='api.Student'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='class',
|
||||
name='unconfirmed',
|
||||
field=models.ManyToManyField(blank=True, related_name='unconfirmed', to='api.Student'),
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Assignment',
|
||||
fields=[
|
||||
|
|
|
@ -1,31 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-15 00:46
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='class',
|
||||
name='confirmed',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='class',
|
||||
name='confirmed',
|
||||
field=models.ManyToManyField(blank=True, related_name='confirmed', to='api.Student'),
|
||||
),
|
||||
migrations.RemoveField(
|
||||
model_name='class',
|
||||
name='unconfirmed',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='class',
|
||||
name='unconfirmed',
|
||||
field=models.ManyToManyField(blank=True, related_name='unconfirmed', to='api.Student'),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-15 02:33
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0002_auto_20200615_0046'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='teacher',
|
||||
name='classes',
|
||||
field=models.ManyToManyField(blank=True, related_name='teacher', to='api.Class'),
|
||||
),
|
||||
]
|
|
@ -1,22 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-15 02:55
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0003_auto_20200615_0233'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='teacher',
|
||||
name='classes',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='class',
|
||||
name='teachers',
|
||||
field=models.ManyToManyField(blank=True, related_name='teachers', to='api.Teacher'),
|
||||
),
|
||||
]
|
|
@ -1,23 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-15 00:48
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('api', '0004_auto_20200614_2107'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RemoveField(
|
||||
model_name='student',
|
||||
name='id',
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='student',
|
||||
name='ion_user',
|
||||
field=models.CharField(default='2022rkhondak', max_length=100, primary_key=True, serialize=False),
|
||||
preserve_default=False,
|
||||
),
|
||||
]
|
|
@ -39,7 +39,7 @@ class Class(models.Model):
|
|||
|
||||
class Teacher(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
username = models.CharField(max_length=100)
|
||||
ion_user = models.CharField(max_length=100)
|
||||
classes=models.ManyToManyField(Class, blank=True, related_name='classes')
|
||||
git=models.CharField(max_length=100, default="", blank=True)
|
||||
|
||||
|
@ -50,16 +50,6 @@ class Teacher(models.Model):
|
|||
def save(self, *args, **kwargs):
|
||||
super(Teacher, self).save(*args, **kwargs)
|
||||
|
||||
class Student(models.Model):
|
||||
user = models.OneToOneField(User, on_delete=models.CASCADE)
|
||||
ion_user=models.CharField(primary_key=True, max_length=100)
|
||||
grade = models.IntegerField(default=0, blank=True)
|
||||
git=models.CharField(default="", max_length=100, blank=True)
|
||||
repo=models.URLField(default="", blank=True)
|
||||
classes=models.CharField(max_length=100, default="", blank=True)
|
||||
added_to=models.CharField(max_length=100, default="", blank=True)
|
||||
completed=models.TextField(default="", blank=True)
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from django.contrib.auth.models import User, Group
|
||||
from .models import Student, Teacher, Classes, Assignment, DefFiles
|
||||
from .models import Student, Teacher, Class, Assignment, DefFiles
|
||||
from rest_framework import serializers, permissions
|
||||
from django.contrib.auth.models import User
|
||||
from .permissions import IsOwnerOrReadOnly,isTeacher
|
||||
|
@ -15,40 +15,38 @@ class UserSerializer(serializers.HyperlinkedModelSerializer):
|
|||
# class DefFilesSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# class Meta:
|
||||
# model = DefFiles
|
||||
# fields = ['name', 'path','assignment','classes', "teacher",'url', 'id']
|
||||
# fields = ['name', 'path','assignment','Class', "teacher",'url', 'id']
|
||||
|
||||
class AssignmentSerializer(serializers.HyperlinkedModelSerializer):
|
||||
#permissions_classes = [permissions.IsAuthenticatedOrReadOnly]
|
||||
#permissions_Class = [permissions.IsAuthenticatedOrReadOnly]
|
||||
# files = DefFilesSerializer(many=True, read_only=True,allow_null=True)
|
||||
owner = serializers.ReadOnlyField(source='owner.username')
|
||||
|
||||
class Meta:
|
||||
model = Assignment
|
||||
# fields = ['url','name', 'due_date', 'path' , "classes","teacher",'owner']
|
||||
fields = ['name', 'due_date', 'path' , "classes","teacher",'owner']
|
||||
# fields = ['url','name', 'due_date', 'path' , "Class","teacher",'owner']
|
||||
fields = ['name', 'due_date', 'path' , "Class","teacher",'owner']
|
||||
|
||||
class ClassesSerializer(serializers.HyperlinkedModelSerializer):
|
||||
class ClassSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# assignments = AssignmentSerializer(many=True, read_only=True,allow_null=True)
|
||||
# default_file=DefFilesSerializer(many=True, read_only=True,allow_null=True)
|
||||
owner = serializers.ReadOnlyField(source='owner.username')
|
||||
class Meta:
|
||||
model = Classes
|
||||
model = Class
|
||||
# fields = ['url','name', 'repo','path', "teacher",'assignments',"default_file", 'confirmed', 'unconfirmed','owner']
|
||||
fields = ['name', 'repo','path', "teacher",'assignments',"default_file", 'confirmed', 'unconfirmed','owner']
|
||||
|
||||
class StudentSerializer(serializers.HyperlinkedModelSerializer):
|
||||
# classes = ClassesSerializer(many=True, read_only=True,allow_null=True)
|
||||
# Class = ClassSerializer(many=True, read_only=True,allow_null=True)
|
||||
class Meta:
|
||||
model = Student
|
||||
# fields = ['url','first_name', 'last_name', 'grade','email','student_id', 'git','ion_user','classes','added_to','completed', 'repo','owner']
|
||||
fields = ['url','grade', 'ion_user','git','user','classes','added_to','completed', 'repo']
|
||||
# fields = ['url','first_name', 'last_name', 'grade','email','student_id', 'git','ion_user','Class','added_to','completed', 'repo','owner']
|
||||
fields = ['url','grade', 'ion_user','git','user','Class','added_to','completed', 'repo']
|
||||
|
||||
class TeacherSerializer(serializers.ModelSerializer):
|
||||
# classes = ClassesSerializer(many=True, read_only=True,allow_null=True)
|
||||
# Class = ClassSerializer(many=True, read_only=True,allow_null=True)
|
||||
owner = serializers.ReadOnlyField(source='owner.username')
|
||||
class Meta:
|
||||
model = Teacher
|
||||
# fields = ['url','first_name', 'last_name','git','ion_user', 'email','classes','owner']
|
||||
fields = ['first_name', 'last_name','git','ion_user', 'email','classes','owner']
|
||||
|
||||
|
||||
# fields = ['url','first_name', 'last_name','git','ion_user', 'email','Class','owner']
|
||||
fields = ['first_name', 'last_name','git','ion_user', 'email','Class','owner']
|
||||
|
|
|
@ -1,26 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-14 19:13
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='Token',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('username', models.TextField()),
|
||||
('email', models.TextField()),
|
||||
('first_name', models.TextField()),
|
||||
('last_name', models.TextField()),
|
||||
('isStudent', models.BooleanField()),
|
||||
('token', models.CharField(max_length=255)),
|
||||
],
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-14 20:44
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='token',
|
||||
name='isStudent',
|
||||
field=models.BooleanField(default=True),
|
||||
),
|
||||
]
|
|
@ -1,18 +0,0 @@
|
|||
# Generated by Django 3.0.7 on 2020-06-14 21:07
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('users', '0002_auto_20200614_2044'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='token',
|
||||
name='grade',
|
||||
field=models.IntegerField(default=9),
|
||||
),
|
||||
]
|
|
@ -102,10 +102,10 @@ def create_account (request):
|
|||
if isStudent:
|
||||
profile = Student(user=user, git=git, grade=grade, ion_user=username)
|
||||
else:
|
||||
|
||||
profile = Teacher(user=user, git=git, ion_user=usernam)
|
||||
|
||||
profile.save()
|
||||
|
||||
token.delete()
|
||||
print (user)
|
||||
messages.success(request, "Your SkoolOS account has successfully been created")
|
||||
return redirect(f'/login/?username={username}')
|
||||
|
|
Loading…
Reference in New Issue
Block a user