mirror of
https://github.com/lemeow125/StudE-Backend.git
synced 2025-06-29 00:35:45 +08:00
Painstakingly added an endpoint to show messages from the current study group of the user
This commit is contained in:
parent
11d6887af8
commit
fbe047e8a2
26 changed files with 223 additions and 47 deletions
|
@ -1,4 +1,4 @@
|
|||
# Generated by Django 4.2.2 on 2023-06-27 13:08
|
||||
# Generated by Django 4.2.2 on 2023-06-27 15:21
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
@ -18,6 +18,7 @@ class Migration(migrations.Migration):
|
|||
name='StudyGroup',
|
||||
fields=[
|
||||
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('name', models.CharField(max_length=48)),
|
||||
('x', models.FloatField(null=True)),
|
||||
('y', models.FloatField(null=True)),
|
||||
('active', models.BooleanField(default=False)),
|
||||
|
|
|
@ -4,6 +4,7 @@ from subjects.models import Subject
|
|||
|
||||
|
||||
class StudyGroup(models.Model):
|
||||
name = models.CharField(max_length=48)
|
||||
users = models.ManyToManyField(
|
||||
'student_status.StudentStatus', through='StudyGroupMembership')
|
||||
x = models.FloatField(null=True)
|
||||
|
@ -18,3 +19,6 @@ class StudyGroupMembership(models.Model):
|
|||
'student_status.StudentStatus', on_delete=models.CASCADE)
|
||||
study_group = models.ForeignKey(
|
||||
'study_groups.StudyGroup', on_delete=models.CASCADE)
|
||||
|
||||
def __str__(self):
|
||||
return f'StudyGroupMembership: User={self.user_id}, StudyGroup={self.study_group_id}'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue