from django.conf import settings from django.conf.urls import patterns, include, url from django.contrib.staticfiles.urls import static, staticfiles_urlpatterns from tastypie import api from piplmesh.account import models, views as account_views from piplmesh.api import resources from piplmesh.frontend import debug as debug_views, views as frontend_views from piplmesh import panels # PiplMesh panels auto-discovery panels.panels_pool.discover_panels() API_NAME = 'v1' v1_api = api.Api(api_name=API_NAME) v1_api.register(resources.UserResource()) v1_api.register(resources.UploadedFileResource()) v1_api.register(resources.PostResource()) js_info_dict = { 'packages': ('django.conf', ), } I18N_URL = settings.I18N_URL.lstrip('/') PUSH_SERVER_URL = settings.PUSH_SERVER_URL.lstrip('/') urlpatterns = patterns( '', url(r'^$', frontend_views.HomeView.as_view(), name='home'), url(r'^about/$', frontend_views.AboutView.as_view(), name='about'),
""" URLs for accessing resources via the API. """ from django.conf.urls.defaults import * from tastypie import api from portal.api import resources v1_api = api.Api(api_name="v1") v1_api.register(resources.ResourceResource()) v1_api.register(resources.RepositoryResource()) v1_api.register(resources.CollectionResource()) v1_api.register(resources.AuthorityResource()) urlpatterns = patterns('', url(r'^', include(v1_api.urls)), )
from django.core.urlresolvers import reverse from tastypie import fields, api from tastypie.resources import ModelResource from tastypie.authorization import Authorization, DjangoAuthorization from tastypie.authentication import SessionAuthentication from registration.models import Registration, Event, RaceClass, Car, \ UserProfile, User, Coupon, Club, Season, Location, Membership, Group, \ Result, Run, Session from garage.api_auth import ClubAdminAuthorization, UserAdminAuthorization v1_api = api.Api(api_name='v1') class UserResource(ModelResource): cars = fields.ToManyField('garage.api.CarResource', lambda b: b.obj.get_profile().cars, full=True, null=True, blank=True, readonly=True) coupons = fields.ToManyField('garage.api.CouponResource', lambda b: b.obj.get_profile().coupons, full=True, null=True, blank=True,
from tastypie import api import resources v1 = api.Api(api_name='v1') v1.register(resources.Accounter()) v1.register(resources.Site()) v1.register(resources.User())