Files
Pinry/pinry/api/api.py
Isaac Bythewood de45705e62 Cleaning up code.
2012-07-25 02:28:01 +00:00

29 lines
814 B
Python

from tastypie.resources import ModelResource
from tastypie import fields
from tastypie.authentication import BasicAuthentication
from tastypie.authorization import DjangoAuthorization
from django.contrib.auth.models import User
from pinry.pins.models import Pin
class PinResource(ModelResource): # pylint: disable-msg=R0904
class Meta:
queryset = Pin.objects.all()
resource_name = 'pin'
include_resource_uri = False
filtering = {
'published': ['gt'],
}
class UserResource(ModelResource):
class Meta:
queryset = User.objects.all()
resource_name = 'auth/user'
excludes = ['email', 'password', 'is_superuser']
# Add it here.
authentication = BasicAuthentication()
authorization = DjangoAuthorization()