'''
API for the laws app
'''
import logging
from django.core.urlresolvers import reverse
from tastypie.constants import ALL
import tastypie.fields as fields
from agendas.templatetags.agendas_tags import agendas_for

from apis.resources.base import BaseResource
from mks.models import Member, Party
from mks.api import MemberResource
from video.utils import get_videos_queryset
from video.api import VideoResource
from links.models import Link
from links.api import LinkResource
from models import Law, Bill, Vote, VoteAction, PrivateProposal

from simple.management.commands.syncdata_globals import p_explanation
from agendas.models import AgendaVote

from datetime import datetime, timedelta
logger = logging.getLogger("open-knesset.laws.api")

class LawResource(BaseResource):
    class Meta(BaseResource.Meta):
        queryset = Law.objects.all()
        allowed_methods = ['get']
class TagResource(BaseResource):pass
class ProvateProposalResource(BaseResource):
    class Meta(BaseResource.Meta):
        queryset = PrivateProposal.objects.all()
        allowed_methods = ['get']

        filtering = dict(from_date=ALL,
                         to_date=ALL)
                         

    tags = fields.ToManyField(TagResource,
                              'tags',
                              
                              null=True,
                              full=False)

    def dehydrate_tags(self, bundle):
		return [tag.name for tag in bundle.obj.bill.tags]
		
    def build_filters(self, filters={}):