-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #25 from LaurierCS/pedro/update-group-model-id
Pedro/update group model
- Loading branch information
Showing
9 changed files
with
97 additions
and
62 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
api/optimeet/groups/migrations/0002_remove_group_id_alter_group_group_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
# Generated by Django 4.1.12 on 2023-11-03 20:49 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('groups', '0001_initial'), | ||
] | ||
|
||
operations = [ | ||
migrations.RemoveField( | ||
model_name='group', | ||
name='id', | ||
), | ||
migrations.AlterField( | ||
model_name='group', | ||
name='group_id', | ||
field=models.BigAutoField(default=4310021863, primary_key=True, serialize=False), | ||
), | ||
] |
32 changes: 0 additions & 32 deletions
32
api/optimeet/groups/migrations/0002_remove_recommendation_group_and_more.py
This file was deleted.
Oops, something went wrong.
19 changes: 19 additions & 0 deletions
19
api/optimeet/groups/migrations/0003_alter_group_group_id.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# Generated by Django 4.1.12 on 2023-11-03 21:18 | ||
|
||
import builtins | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('groups', '0002_remove_group_id_alter_group_group_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='group', | ||
name='group_id', | ||
field=models.CharField(default=builtins.id, max_length=10, primary_key=True, serialize=False), | ||
), | ||
] |
28 changes: 28 additions & 0 deletions
28
api/optimeet/groups/migrations/0004_alter_group_group_id_alter_group_host_id_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Generated by Django 4.1.12 on 2023-11-03 21:31 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('groups', '0003_alter_group_group_id'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='group', | ||
name='group_id', | ||
field=models.CharField(max_length=10, primary_key=True, serialize=False), | ||
), | ||
migrations.AlterField( | ||
model_name='group', | ||
name='host_id', | ||
field=models.CharField(max_length=64), | ||
), | ||
migrations.AlterField( | ||
model_name='group', | ||
name='name', | ||
field=models.CharField(max_length=30), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,17 @@ | ||
from typing import Any | ||
from django.db import models | ||
|
||
class Group(models.Model): | ||
|
||
ACTIVE = "A" | ||
FINISHED = "F" | ||
|
||
status_choices = [(ACTIVE, "Active"), (FINISHED, "Finished")] | ||
|
||
group_id = models.CharField(max_length=10, primary_key=True, blank=True) | ||
|
||
name = models.CharField(max_length = 30) | ||
host_id = models.CharField(max_length=64) | ||
max_capacity = models.IntegerField(default=5) | ||
status = models.CharField(max_length=1, choices=status_choices, default = ACTIVE) | ||
|
||
name = models.CharField(max_length = 30, default='') | ||
host_id = models.CharField(max_length=64, default='') | ||
max_capacity = models.IntegerField(default=5) | ||
status = models.CharField(max_length=1, choices=status_choices, default = ACTIVE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,15 @@ | ||
from rest_framework import serializers | ||
from . import models | ||
from random import randint | ||
|
||
def rnd_id(): return randint(1000000000,9999999999) | ||
|
||
class GroupSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = models.Group | ||
fields = '__all__' | ||
|
||
def create(self, validated_data): | ||
validated_data['group_id'] = rnd_id() | ||
return super(GroupSerializer, self).create(validated_data) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters