mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-28 16:25:44 +08:00
Hotfix for registration crashing due to non-unique StudentStatus instance creation
This commit is contained in:
parent
1eb1f71232
commit
d7f88e1770
16 changed files with 27 additions and 102 deletions
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 4.2.3 on 2023-09-25 13:07
|
||||
# Generated by Django 4.2.5 on 2023-10-01 16:37
|
||||
|
||||
import accounts.models
|
||||
import django.contrib.auth.models
|
||||
|
@ -13,9 +13,9 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('courses', '0001_initial'),
|
||||
('semesters', '0001_initial'),
|
||||
('auth', '0012_alter_user_first_name_max_length'),
|
||||
('courses', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 4.2.3 on 2023-09-25 13:07
|
||||
# Generated by Django 4.2.5 on 2023-10-01 16:37
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -9,9 +9,9 @@ class Migration(migrations.Migration):
|
|||
initial = True
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0001_initial'),
|
||||
('year_levels', '0001_initial'),
|
||||
('subjects', '0001_initial'),
|
||||
('accounts', '0001_initial'),
|
||||
('auth', '0012_alter_user_first_name_max_length'),
|
||||
]
|
||||
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
# Generated by Django 4.2.3 on 2023-09-30 15:35
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0002_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='customuser',
|
||||
options={},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customuser',
|
||||
unique_together={('first_name', 'last_name')},
|
||||
),
|
||||
]
|
|
@ -1,21 +0,0 @@
|
|||
# Generated by Django 4.2.3 on 2023-10-01 05:25
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('accounts', '0003_alter_customuser_options_and_more'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterModelOptions(
|
||||
name='customuser',
|
||||
options={'verbose_name': 'user', 'verbose_name_plural': 'users'},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='customuser',
|
||||
unique_together=set(),
|
||||
),
|
||||
]
|
|
@ -155,10 +155,12 @@ class UserRegistrationSerializer(serializers.ModelSerializer):
|
|||
user.set_password(validated_data['password'])
|
||||
user.save()
|
||||
|
||||
StudentStatus.objects.create(
|
||||
StudentStatus.objects.update_or_create(
|
||||
user=user,
|
||||
active=False,
|
||||
location=Point(0, 0),
|
||||
subject=None
|
||||
defaults={
|
||||
'active': False,
|
||||
'location': Point(0, 0),
|
||||
'subject': None
|
||||
}
|
||||
)
|
||||
return user
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue