Skip to content
This repository has been archived by the owner on Apr 25, 2023. It is now read-only.

Commit

Permalink
Represent is watching model in user model and not awkard view codE
Browse files Browse the repository at this point in the history
  • Loading branch information
alonisser committed Oct 1, 2016
1 parent 57d1625 commit 686191c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions mks/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,12 @@ class MemberDetailView(DetailView):
.select_related('current_party',
'current_party__knesset',
'voting_statistics',
'awards',
'awards__award_type') \
.prefetch_related('parties')
) \
.prefetch_related('parties',
'mmm_documents',
'awards_and_convictions',
'person',
'awards_and_convictions__award_type')

MEMBER_INITIAL_DATA = 2

Expand Down Expand Up @@ -340,8 +343,8 @@ def get_context_data(self, **kwargs):
member = context['object']
current_knesset_start_date = Knesset.objects.current_knesset().start_date
if self.request.user.is_authenticated():
p = self.request.user.profiles.get()
watched = member in p.members
profile = self.request.user.profiles.get()
watched = profile.is_watching_member(member)
cached_context = None
else:
watched = False
Expand Down Expand Up @@ -418,6 +421,7 @@ def get_context_data(self, **kwargs):
for action in actor_stream(member).filter(verb='attended'):
i = i + 1
if i == 20:
# JESUS what language are we writing here? and is this a way to do a "limit"?
break
committee_type = (action and action.target and
action.target.committee and
Expand Down

0 comments on commit 686191c

Please sign in to comment.