This commit is contained in:
cuom1999 2023-11-01 21:50:36 -05:00
parent 45587d0884
commit b6c9ce4763

View file

@ -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