mirror of
https://github.com/nikdoof/limetime.git
synced 2025-12-17 12:49:23 +00:00
Added location lookup API
This commit is contained in:
18
app/timer/api.py
Normal file
18
app/timer/api.py
Normal file
@@ -0,0 +1,18 @@
|
||||
from tastypie.resources import ModelResource, ALL, ALL_WITH_RELATIONS
|
||||
from tastypie.api import Api
|
||||
from timer.models import Location
|
||||
|
||||
|
||||
class LocationResource(ModelResource):
|
||||
class Meta:
|
||||
queryset = Location.objects.all()
|
||||
resource_name = 'location'
|
||||
include_resource_uri = False
|
||||
limit = 100
|
||||
excludes = ['x', 'y', 'z']
|
||||
filtering = {
|
||||
'name': ['exact', 'contains'],
|
||||
}
|
||||
|
||||
v1_api = Api(api_name='1.0')
|
||||
v1_api.register(LocationResource())
|
||||
Reference in New Issue
Block a user