from tastytools.api import Api from apps.front.api import resources api = Api(api_name='v1') api.register(modules=[resources])
Hook up the resources via the tastytools documentation """ # Tastytools is used to automatically build API documentation from tastytools.api import Api # Create a new API that binds together the existing APIs v1_api = Api(api_name='v1') # --- IDEA API --- from ideasapp.api import IdeaResource from ideasapp.api import CommentResource from ideasapp.api import TagResource from ideasapp.api import ProtectiveMarkingResource v1_api.register(CommentResource()) v1_api.register(TagResource()) v1_api.register(ProtectiveMarkingResource()) # --- PROJECTS API --- from projectsapp.api import ProjectResource from projectsapp.api import CommentResource from projectsapp.api import TagResource from projectsapp.api import ProtectiveMarkingResource v1_api.register(ProjectResource()) v1_api.register(IdeaResource()) v1_api.register(CommentResource()) v1_api.register(TagResource()) v1_api.register(ProtectiveMarkingResource())
from tastytools.api import Api from api.resources import PostResource, TimelineResource api = Api(api_name="test") api.register(PostResource()) api.register(TimelineResource()) urlpatterns = api.urls
from django.conf.urls.defaults import * from tastytools.api import Api from .system_api import (SystemResource, ServerModelResource, OperatingSystemResource, KeyValueResource, AllocationResource, LocationResource, SystemRackResource, SystemStatusResource, OperatingSystemData) system_api = Api(api_name='systems') system_api.register(SystemResource()) system_api.register(ServerModelResource()) system_api.register(OperatingSystemResource()) system_api.register(KeyValueResource()) system_api.register(AllocationResource()) system_api.register(LocationResource()) system_api.register(SystemRackResource()) system_api.register(SystemStatusResource()) system_api.register_testdata(OperatingSystemData) urlpatterns = patterns('', (r'', include(system_api.urls)), (r'^tastytools/', include('tastytools.urls'), {'api_name': system_api.api_name}), )
resource_name = 'tournament' allowed_methods = ['get'] authentication = AuthenticationByMethod('GET') authorization = Authorization() filtering = { "players": ALL_WITH_RELATIONS, } class GameResource(CachipunResource): """ Resource model for the Game model """ players = fields.ToManyField(UserResource, 'players', help_text="The players plaing this game", full=True, ) class Meta(CachipunResource.Meta): """ Metadata for the user resource """ queryset = Game.objects.all() resource_name = 'game' allowed_methods = ['get'] authentication = AuthenticationByMethod('GET') authorization = Authorization() filtering = { "players": ALL_WITH_RELATIONS, } api = Api(api_name='resources') api.register(GameResource()) api.register(TournamentResource()) api.register(UserResource())