Change notification backend
This commit is contained in:
parent
5f97491f0d
commit
7f854c40dd
15 changed files with 188 additions and 134 deletions
|
@ -18,6 +18,9 @@ class Room(models.Model):
|
|||
Profile, related_name="user_two", verbose_name="user 2", on_delete=CASCADE
|
||||
)
|
||||
|
||||
class Meta:
|
||||
app_label = "chat_box"
|
||||
|
||||
@cache_wrapper(prefix="Rc")
|
||||
def contain(self, profile):
|
||||
return self.user_one == profile or self.user_two == profile
|
||||
|
@ -58,6 +61,7 @@ class Message(models.Model):
|
|||
indexes = [
|
||||
models.Index(fields=["hidden", "room", "-id"]),
|
||||
]
|
||||
app_label = "chat_box"
|
||||
|
||||
|
||||
class UserRoom(models.Model):
|
||||
|
@ -70,6 +74,7 @@ class UserRoom(models.Model):
|
|||
|
||||
class Meta:
|
||||
unique_together = ("user", "room")
|
||||
app_label = "chat_box"
|
||||
|
||||
|
||||
class Ignore(models.Model):
|
||||
|
@ -82,6 +87,9 @@ class Ignore(models.Model):
|
|||
)
|
||||
ignored_users = models.ManyToManyField(Profile)
|
||||
|
||||
class Meta:
|
||||
app_label = "chat_box"
|
||||
|
||||
@classmethod
|
||||
def is_ignored(self, current_user, new_friend):
|
||||
try:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue