Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
piks3l
Respect My Net
Commits
2ec5766e
Commit
2ec5766e
authored
Oct 20, 2012
by
Guyzmo
Browse files
[ENH] added API definition file
parent
fc78552b
Changes
1
Hide whitespace changes
Inline
Side-by-side
bt/api.py
0 → 100644
View file @
2ec5766e
#from django.contrib.auth.models import User
from
tastypie
import
fields
from
tastypie.authorization
import
DjangoAuthorization
from
tastypie.resources
import
ModelResource
,
ALL
#, ALL_WITH_RELATIONS
from
bt.models
import
Violation
#class UserResource(ModelResource):
# class Meta:
# queryset = User.objects.all()
# resource_name = 'auth/user'
# excludes = ['email', 'password', 'is_superuser']
class
APIResource
(
ModelResource
):
# user = fields.ForeignKey(UserResource, 'user')
class
Meta
:
queryset
=
Violation
.
objects
.
all
()
list_allowed_methods
=
[
'get'
,
'post'
]
detail_allowed_methods
=
[
'get'
,
'post'
,
'put'
,
'delete'
]
resource_name
=
'violations'
authorization
=
DjangoAuthorization
()
filtering
=
{
'country'
:
ALL
,
'operator'
:
ALL
,
'activationid'
:
ALL
,
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment