diff --git a/stude/courses/models.py b/stude/courses/models.py index f31467c..491a949 100644 --- a/stude/courses/models.py +++ b/stude/courses/models.py @@ -19,6 +19,9 @@ class SubjectCourse(models.Model): course = models.ForeignKey( 'courses.Course', on_delete=models.CASCADE, null=True) + def __str__(self): + return (self.subject + ' under course ' + self.course) + @receiver(post_migrate) def populate_courses(sender, **kwargs): diff --git a/stude/student_status/models.py b/stude/student_status/models.py index 3a3c4dc..d84fb43 100644 --- a/stude/student_status/models.py +++ b/stude/student_status/models.py @@ -16,3 +16,6 @@ class StudentStatus(models.Model): timestamp = models.DateField(auto_now_add=True) study_group = models.ManyToManyField( 'study_groups.StudyGroup', through='study_groups.StudyGroupMembership', blank=True) + + def __str__(self): + return self.user.full_name diff --git a/stude/study_groups/admin.py b/stude/study_groups/admin.py index fcfbcbe..601cdc1 100644 --- a/stude/study_groups/admin.py +++ b/stude/study_groups/admin.py @@ -1,6 +1,7 @@ from django.contrib import admin from .models import StudyGroup, StudyGroupMembership +from leaflet.admin import LeafletGeoAdmin -admin.site.register(StudyGroup) +admin.site.register(StudyGroup, LeafletGeoAdmin) admin.site.register(StudyGroupMembership) diff --git a/stude/study_groups/models.py b/stude/study_groups/models.py index bdfc236..66e3682 100644 --- a/stude/study_groups/models.py +++ b/stude/study_groups/models.py @@ -14,6 +14,9 @@ class StudyGroup(models.Model): active = models.BooleanField(default=False) timestamp = models.DateField(auto_now_add=True) + def __str__(self): + return self.name + class StudyGroupMembership(models.Model): user = models.ForeignKey( @@ -22,4 +25,4 @@ class StudyGroupMembership(models.Model): 'study_groups.StudyGroup', on_delete=models.CASCADE) def __str__(self): - return f'StudyGroupMembership: User={self.user_id}, StudyGroup={self.study_group_id}' + return f'StudyGroupMembership: User={self.user}, StudyGroup={self.study_group.name}' diff --git a/stude/studygroup_messages/models.py b/stude/studygroup_messages/models.py index d864ea0..ef2609c 100644 --- a/stude/studygroup_messages/models.py +++ b/stude/studygroup_messages/models.py @@ -9,3 +9,6 @@ class Message(models.Model): study_group = models.ForeignKey(StudyGroup, on_delete=models.CASCADE) message_content = models.TextField(max_length=1024) timestamp = models.DateTimeField(auto_now_add=True) + + def __str__(self): + return f'Message: User={self.user.full_name}, Study_group={self.study_group.name}, ID={self.id}'