@@ -134,8 +134,8 @@ class GroupPhotoInfo(CreateUpdateMixin): |
||
| 134 | 134 |
def photo_info(self): |
| 135 | 135 |
return {
|
| 136 | 136 |
'photo_id': self.pk, |
| 137 |
- 'photo_path': self.photo_url, |
|
| 138 |
- 'photo_thumbnail_path': self.photo_thumbnail_url, |
|
| 137 |
+ 'photo_url': self.photo_url, |
|
| 138 |
+ 'photo_thumbnail_url': self.photo_thumbnail_url, |
|
| 139 | 139 |
} |
| 140 | 140 |
|
| 141 | 141 |
|
@@ -6,6 +6,8 @@ from django.utils.translation import ugettext_lazy as _ |
||
| 6 | 6 |
|
| 7 | 7 |
from pai2.basemodels import CreateUpdateMixin |
| 8 | 8 |
|
| 9 |
+from group.models import GroupPhotoInfo |
|
| 10 |
+ |
|
| 9 | 11 |
|
| 10 | 12 |
class UserMessageInfo(CreateUpdateMixin): |
| 11 | 13 |
SYSTEM = 'system' |
@@ -57,6 +59,10 @@ class UserMessageInfo(CreateUpdateMixin): |
||
| 57 | 59 |
|
| 58 | 60 |
@property |
| 59 | 61 |
def msg_info(self): |
| 62 |
+ try: |
|
| 63 |
+ group_photo = GroupPhotoInfo.objects.get(pk=self.photo_id) |
|
| 64 |
+ except GroupPhotoInfo.DoesNotExist: |
|
| 65 |
+ group_photo = None |
|
| 60 | 66 |
return {
|
| 61 | 67 |
'pk': self.pk, |
| 62 | 68 |
'from_uid': self.from_uid, |
@@ -64,6 +70,8 @@ class UserMessageInfo(CreateUpdateMixin): |
||
| 64 | 70 |
'from_avatar': self.from_avatar, |
| 65 | 71 |
'group_id': self.group_id, |
| 66 | 72 |
'photo_id': self.photo_id, |
| 73 |
+ 'photo_url': group_photo and group_photo.photo_url, |
|
| 74 |
+ 'photo_thumbnail_url': group_photo and group_photo.photo_thumbnail_url, |
|
| 67 | 75 |
'msg_title': self.msg_title, |
| 68 | 76 |
'msg_content': self.msg_content, |
| 69 | 77 |
'read': self.read, |