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

Commit

Permalink
add a link to the source knesset vote page
Browse files Browse the repository at this point in the history
  • Loading branch information
OriHoch committed Feb 10, 2016
1 parent f6dce59 commit 39694b4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions laws/management/commands/scrape_votes.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
from simple.scrapers.management import BaseKnessetDataserviceCollectionCommand
from mks.models import Member
from simple.management.commands.syncdata import Command as SyncdataCommand
from links.models import Link
from django.contrib.contenttypes.models import ContentType


class Command(BaseKnessetDataserviceCollectionCommand):
Expand Down Expand Up @@ -46,6 +48,10 @@ def _create_new_object(self, dataservice_vote):
raise Exception('vote %s: could not find member id %s'%(dataservice_vote.id, member_id))
vote.update_vote_properties()
SyncdataCommand().find_synced_protocol(vote)
Link.objects.create(
title=u'ההצבעה באתר הכנסת', url='http://www.knesset.gov.il/vote/heb/Vote_Res_Map.asp?vote_id_t=%s'%vote.src_id,
content_type=ContentType.objects.get_for_model(vote), object_pk=str(vote.id)
)
return vote
# if v.full_text_url != None:
# l = Link(title=u'מסמך הצעת החוק באתר הכנסת', url=v.full_text_url, content_type=ContentType.objects.get_for_model(v), object_pk=str(v.id))
Expand All @@ -56,5 +62,6 @@ def _recreate_object(self, vote_id):
vote_src_id = vote.src_id
dataservice_vote = self.DATASERVICE_CLASS.get(vote_src_id)
VoteAction.objects.filter(vote=vote).delete()
Link.objects.filter(content_type=ContentType.objects.get_for_model(vote), object_pk=vote.id).delete()
vote.delete()
return self._create_new_object(dataservice_vote)

0 comments on commit 39694b4

Please sign in to comment.