diff options
author | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-14 06:21:31 +0100 |
---|---|---|
committer | jdlugosz963 <jdlugosz963@gmail.com> | 2021-12-14 06:21:31 +0100 |
commit | 8c1767884dedb6c87906265a2c35a3f1a6124a6e (patch) | |
tree | 591086a3c6ca0164b1b239a0f6f3b0a59041114d | |
parent | 461be825205a1a3e3f705ebef25d20fe69733897 (diff) | |
download | lom_api-8c1767884dedb6c87906265a2c35a3f1a6124a6e.tar.gz lom_api-8c1767884dedb6c87906265a2c35a3f1a6124a6e.zip |
add __str__ method to chat model veiw
-rw-r--r-- | chat_api/models.py | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/chat_api/models.py b/chat_api/models.py index 4b354f4..3be795a 100644 --- a/chat_api/models.py +++ b/chat_api/models.py | |||
@@ -17,6 +17,9 @@ class Group(models.Model): | |||
17 | users = models.ManyToManyField(User, related_name="users_group") | 17 | users = models.ManyToManyField(User, related_name="users_group") |
18 | create_date = models.DateTimeField(auto_now=True) | 18 | create_date = models.DateTimeField(auto_now=True) |
19 | 19 | ||
20 | def __str__(self): | ||
21 | return self.name | ||
22 | |||
20 | class Gm(models.Model): | 23 | class Gm(models.Model): |
21 | sender = models.ForeignKey(User, related_name="sender_gm", on_delete=models.CASCADE) | 24 | sender = models.ForeignKey(User, related_name="sender_gm", on_delete=models.CASCADE) |
22 | reciever = models.ForeignKey(Group, related_name="receiver_gm", on_delete=models.CASCADE) | 25 | reciever = models.ForeignKey(Group, related_name="receiver_gm", on_delete=models.CASCADE) |