コード例 #1
0
ファイル: api.py プロジェクト: stadine/froide
 class Meta:
     # allowed_methods = ['get']
     queryset = Jurisdiction.objects.get_visible()
     resource_name = 'jurisdiction'
     fields = ['id', 'name', 'rank', 'description', 'slug']
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()
コード例 #2
0
 class Meta:
     allowed_methods = ['get', 'put']
     queryset = FoiRequest.objects.filter(visibility=2)
     resource_name = 'request'
     fields = [
         'id', 'jurisdiction', 'is_foi', 'checked', 'refusal_reason',
         'costs', 'public', 'law', 'same_as_count', 'same_as', 'due_date',
         'resolved_on', 'last_message', 'first_message', 'status',
         'public_body', 'resolution', 'slug', 'title', 'reference'
     ]
     filtering = {
         'slug': ALL,
         'title': ALL,
         'first_message': ALL,
         'is_foi': ALL,
         'checked': ALL,
         'jurisdiction': ALL,
         'jurisdiction': ALL,
         'public': ALL,
         'tags': ALL,
         'same_as': ALL,
         'status': ALL,
         'reference': ALL,
         'resolution': ALL,
         'public_body': ALL_WITH_RELATIONS
     }
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()
     paginator_class = TastyPaginator
コード例 #3
0
ファイル: api.py プロジェクト: stadine/froide
 class Meta:
     allowed_methods = ['get', 'put', 'post', 'delete']
     queryset = FoiAttachment.objects.filter(belongs_to__request__visibility=2, approved=True)
     resource_name = 'attachment'
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()
     fields = ['id', 'belongs_to', 'name', 'filetype',
         'approved', 'is_redacted', 'size'
     ]
コード例 #4
0
ファイル: api.py プロジェクト: stadine/froide
 class Meta:
     allowed_methods = ['get', 'put', 'delete']
     queryset = FoiMessage.objects.filter(request__visibility=2)
     resource_name = 'message'
     fields = ['id', 'request', 'sent', 'is_response', 'is_postal',
         'is_escalation', 'content_hidden', 'sender_public_body',
         'recipient_public_body', 'status', 'timestamp',
         'redacted', 'not_publishable'
     ]
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()
コード例 #5
0
ファイル: api.py プロジェクト: stadine/froide
 class Meta:
     queryset = FoiLaw.objects.all()
     resource_name = 'law'
     fields = [
         'id', 'name', 'slug', 'description', 'long_description', 'created',
         'updated', 'request_note', 'meta', 'combined', 'letter_start',
         'letter_end', 'jurisdiction', 'priority', 'url',
         'max_response_time', 'max_response_time_unit', 'refusal_reasons',
         'mediator'
     ]
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()
コード例 #6
0
ファイル: api.py プロジェクト: stadine/froide
 class Meta:
     queryset = PublicBody.objects.all()
     resource_name = 'publicbody'
     fields = [
         'id', 'name', 'slug', 'other_names', 'description', 'url',
         'parent', 'root', 'depth', 'classification', 'classification_slug',
         'email', 'contact', 'address', 'website_dump', 'request_note',
         'number_of_requests', 'laws', 'jurisdiction'
     ]
     filtering = {
         "other_names": ALL,
         "name": ALL,
         "slug": ALL,
         "number_of_requests": ALL,
         "jurisdiction": ALL_WITH_RELATIONS,
         "tags": ALL
         # Technically possible, but API docs
         # generation currently crashes here
         # "root": ALL_WITH_RELATIONS,
         # "parent": ALL_WITH_RELATIONS
     }
     paginator_class = TastyPaginator
     authentication = AnonymousGetAuthentication()
     authorization = CustomDjangoAuthorization()