Fix bug
This commit is contained in:
parent
45587d0884
commit
b6c9ce4763
1 changed files with 2 additions and 1 deletions
|
@ -27,9 +27,10 @@ class Room(models.Model):
|
||||||
|
|
||||||
@cache_wrapper(prefix="Rinfo")
|
@cache_wrapper(prefix="Rinfo")
|
||||||
def _info(self):
|
def _info(self):
|
||||||
|
last_msg = self.message_set.first()
|
||||||
return {
|
return {
|
||||||
"user_ids": [self.user_one.id, self.user_two.id],
|
"user_ids": [self.user_one.id, self.user_two.id],
|
||||||
"last_message": self.message_set.first().body,
|
"last_message": last_msg.body if last_msg else None,
|
||||||
}
|
}
|
||||||
|
|
||||||
@cached_property
|
@cached_property
|
||||||
|
|
Loading…
Reference in a new issue