Skip to content

Commit

Permalink
Oprava podpisov, closes #106
Browse files Browse the repository at this point in the history
  • Loading branch information
mireq committed Jul 27, 2019
1 parent 00ce3b4 commit c6c8f6b
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions comments/templatetags/comments_tags.py
Expand Up @@ -40,7 +40,7 @@ def basename(self):
return os.path.basename(self.attachment)


class UserRecord(namedtuple('UserRecord', ['pk', 'avatar', 'email', 'username', 'first_name', 'last_name', 'distribution', 'is_active', 'is_staff', 'is_superuser', 'rating_value'])):
class UserRecord(namedtuple('UserRecord', ['pk', 'avatar', 'email', 'username', 'first_name', 'last_name', 'signature', 'distribution', 'is_active', 'is_staff', 'is_superuser', 'rating_value'])):
def get_absolute_url(self):
return reverse('accounts:profile', kwargs={'pk': self.pk})

Expand All @@ -62,7 +62,7 @@ class S(str):

class CommentRecord(object):
__slots__ = [
'pk', 'created', 'updated', 'ip_address', 'parent_id', 'level', 'is_public', 'is_removed', 'is_locked', 'subject', 'comment', 'user_name', 'user_id', 'user_avatar', 'user_email', 'user_username', 'user_first_name', 'user_last_name', 'user_distribution', 'user_is_active', 'user_is_staff', 'user_is_superuser', 'user_rating',
'pk', 'created', 'updated', 'ip_address', 'parent_id', 'level', 'is_public', 'is_removed', 'is_locked', 'subject', 'comment', 'user_name', 'user_id', 'user_avatar', 'user_email', 'user_username', 'user_first_name', 'user_last_name', 'user_signature', 'user_distribution', 'user_is_active', 'user_is_staff', 'user_is_superuser', 'user_rating',
# extra
'ip_address_avatar', 'next_new', 'prev_new', 'is_new', 'attachments', 'user'
]
Expand All @@ -83,6 +83,7 @@ def __init__(self, *args):
self.user_username,
self.user_first_name,
self.user_last_name,
self.user_signature,
self.user_distribution,
self.user_is_active,
self.user_is_staff,
Expand Down Expand Up @@ -219,7 +220,7 @@ def all(self):
attachments_by_comment = defaultdict(L)
for attachment in attachments:
attachments_by_comment[attachment[0]].append(AttachmentRecord(*attachment[1:]))
queryset = queryset.values_list('pk', 'created', 'updated', 'ip_address', 'parent_id', 'level', 'is_public', 'is_removed', 'is_locked', 'subject', 'filtered_comment', 'user_name', 'user_id', 'user__avatar', 'user__email', 'user__username', 'user__first_name', 'user__last_name', 'user__distribution', 'user__is_active', 'user__is_staff', 'user__is_superuser', 'user__rating__rating')
queryset = queryset.values_list('pk', 'created', 'updated', 'ip_address', 'parent_id', 'level', 'is_public', 'is_removed', 'is_locked', 'subject', 'filtered_comment', 'user_name', 'user_id', 'user__avatar', 'user__email', 'user__username', 'user__first_name', 'user__last_name', 'user__signature', 'user__distribution', 'user__is_active', 'user__is_staff', 'user__is_superuser', 'user__rating__rating')
comments = L([CommentRecord(*row) for row in queryset])
for comment in comments:
comment.attachments = attachments_by_comment[comment.pk]
Expand Down

0 comments on commit c6c8f6b

Please sign in to comment.