Ejemplo n.º 1
0
class TastypieApiGenerator(object):
    def __init__(self, namespace):
        """
        Create api
        :param namespace: namespace should be the application name, as we'll set applications to use application name
         as the url conf namespace
        """
        super(TastypieApiGenerator, self).__init__()
        self.generator = AdvTastypieResourceGenerator()
        # The urlconf_namespace and the above NamespacedModelResource will ensure the name space is added when
        # calling reverse to get the resource uri
        self.v1_api = NamespacedApi(api_name='v1', urlconf_namespace=namespace)

    def get_model_api_url_list(self):
        url_list = [url(r'^api/',
                        include(self.v1_api.urls))]
        return url_list

    def register_all(self, models):
        for model in enum_models(models):
            if hasattr(model, "objects"):
                self.register_resource_for_model(model)

    def register_resource_for_model(self, model):
        resource = self.generator.get_resource(model)
        self.v1_api.register(resource)
Ejemplo n.º 2
0
def register_api():
	api = NamespacedApi(api_name='v1', urlconf_namespace='cgen')
	api.register(CharacterResource())
	api.register(ClassChassisResource())
	api.register(RaceResource())

	return api
Ejemplo n.º 3
0
from django.conf.urls import patterns, include, url
from tastypie.api import NamespacedApi

from user_guide.api import GuideResource, GuideInfoResource


user_guide_api = NamespacedApi(api_name='api', urlconf_namespace='user_guide')
user_guide_api.register(GuideResource())
user_guide_api.register(GuideInfoResource())

urlpatterns = patterns(
    '',
    url(r'', include(user_guide_api.urls, namespace='user_guide'))
)
Ejemplo n.º 4
0
from django.conf.urls import patterns, include, url
from tastypie.api import NamespacedApi

from .api import TourResource, StepResource

api = NamespacedApi(api_name='api', urlconf_namespace='tour')
api.register(TourResource())
api.register(StepResource())

urlpatterns = patterns(
    '',
    url(r'^', include(api.urls, namespace='tour')),
)
Ejemplo n.º 5
0
def topic_models(path, force=False):
    """
        Auto-discover topic-related model by looking into
        a topic package for an ontology file. This will also
        create all api resources and endpoints.

        This will create the following modules:
            {path}
            {path}.models
            {path}.resources
            {path}.summary
            {path}.urls
    """
    topic_module = import_or_create(path, force=force)
    topic_name   = path.split(".")[-1]
    # Ensure that the topic's model exist
    topic = Topic.objects.get(ontology_as_mod=topic_name)
    app_label = topic.app_label()
    # Add '.models to the path if needed
    models_path = path if path.endswith(".models") else '%s.models' % path
    urls_path   = "%s.urls" % path
    # Import or create virtually the models.py file
    models_module = import_or_create(models_path, force=force)
    try:
        # Generates all model using the ontology file.
        # Also overides the default app label to allow data persistance
        if topic.ontology_as_json is not None:
            # JSON ontology
            models = parser.json.parse(topic.ontology_as_json, path, app_label=app_label)
        elif topic.ontology_as_owl is not None:
            # OWL ontology
            models = parser.owl.parse(topic.ontology_as_owl, path, app_label=app_label)
        else:
            models = []
    # except TypeError as e:
    #    if settings.DEBUG: print 'TypeError:', e
    #    models = []
    except ValueError as e:
        if settings.DEBUG: print 'ValueError:', e
        models = []
    # Makes every model available through this module
    for m in models:
        # Record the model
        setattr(models_module, m, models[m])
    # Generates the API endpoints
    api = NamespacedApi(api_name='v1', urlconf_namespace=app_label)
    # Create resources root if needed
    resources = import_or_create("%s.resources" % path, force=force)
    # Creates a resource for each model
    for name in models:
        Resource = utils.create_model_resource(models[name])
        resource_name = "%sResource" % name
        # Register the virtual resource to by importa
        resource_path = "%s.resources.%s" % (path, resource_name)
        # This resource is now available everywhere:
        #  * as an attribute of `resources`
        #  * as a module
        setattr(resources, resource_name, Resource)
        sys.modules[resource_path] = Resource
        # And register it into the API instance
        api.register(Resource())
    # Every app have to instance a SummaryResource class
    summary_path   = "%s.summary" % path
    summary_module = import_or_create(summary_path, force=force)
    # Take the existing summary resource
    if hasattr(summary_module, 'SummaryResource'):
        SummaryResource = summary_module.SummaryResource
    # We create one if it doesn't exist
    else:
        from app.detective.topics.common.summary import SummaryResource as CommonSummaryResource
        attrs           = dict(meta=CommonSummaryResource.Meta)
        SummaryResource = type('SummaryResource', (CommonSummaryResource,), attrs)
    # Register the summary resource
    api.register(SummaryResource())
    # Create url patterns
    urlpatterns = patterns(path, url('', include(api.urls)), )
    # Import or create virtually the url path
    urls_modules = import_or_create(urls_path, force=force)
    # Merge the two url patterns if needed
    if hasattr(urls_modules, "urlpatterns"): urlpatterns += urls_modules.urlpatterns
    # Update the current url pattern
    urls_modules.urlpatterns = urlpatterns
    # API is now up and running,
    # we need to connect its url patterns to global one
    urls = importlib.import_module("app.detective.urls")
    # Add api url pattern with the highest priority
    new_patterns = patterns(app_label,
        url(r'^{0}/{1}/'.format(topic.author, topic.slug), include(urls_path, namespace=app_label) ),
    )
    if hasattr(urls, "urlpatterns"):
        # Merge with a filtered version of the urlpattern to avoid duplicates
        new_patterns += [u for u in urls.urlpatterns if getattr(u, "namespace", None) != app_label ]
    # Then update url pattern
    urls.urlpatterns = new_patterns
    # At last, force the url resolver to reload (because we update it)
    clear_url_caches()
    reload_urlconf()
    return topic_module
Ejemplo n.º 6
0
from django.conf.urls import url, include
from clist import views

from tastypie.api import NamespacedApi as Api
from clist.api import v1

app_name = 'clist'

api_v1 = Api(api_name="v1", urlconf_namespace=f'{app_name}:api')
api_v1.register(v1.ResourceResource())
api_v1.register(v1.ContestResource())

urlpatterns = [
    url(r'^$', views.main, name='main'),
    url(r'^resources/$', views.resources, name='resources'),
    url(r'^resources/dumpdata/$',
        views.resources_dumpdata,
        name='resources_dumpdata'),
    url(r'^resource/(.*)/$', views.resource, name='resource'),
    url(r'^get/events/$', views.get_events),
    url(r'^api/', include((api_v1.urls, app_name), namespace='api')),
    url(
        r'^api/v1/doc/',
        include(('tastypie_swagger.urls', app_name),
                namespace='tastypie_swagger'),
        kwargs={
            'version': '1.0',
            'tastypie_api_module': api_v1,
            'namespace': 'clist:tastypie_swagger',
        },
    ),
Ejemplo n.º 7
0
from django.conf.urls import patterns, include, url
from .api import GameResource
from tastypie.api import NamespacedApi

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='games')
v1_api.register(GameResource())

urlpatterns = patterns('',
    url(r'^api/', include(v1_api.urls)),
)
Ejemplo n.º 8
0
from django.conf.urls import re_path, include
from tastypie.api import NamespacedApi as Api
from clist.api import v1
from clist.api import v2

app_name = 'clist'

api_v1 = Api(api_name='v1', urlconf_namespace=f'{app_name}:api:v1')
api_v1.register(v1.ResourceResource())
api_v1.register(v1.ContestResource())

api_v2 = Api(api_name='v2', urlconf_namespace=f'{app_name}:api:v2')
api_v2.register(v2.ResourceResource())
api_v2.register(v2.ContestResource())
api_v2.register(v2.AccountResource())
api_v2.register(v2.CoderResource())
api_v2.register(v2.StatisticsResource())

apis = [api_v2, api_v1]

urlpatterns = []

for index, api in enumerate(apis):
    name = f'{api.api_name}_doc' if index else 'latest'
    urlpatterns += [
        re_path(r'', include((api.urls, app_name), namespace=api.api_name)),
        re_path(
            f'{api.api_name}/doc/',
            include(('tastypie_swagger.urls', app_name), namespace=name),
            kwargs={
                'version': api.api_name,
Ejemplo n.º 9
0
from django.conf.urls import patterns, url, include

from tastypie.api import NamespacedApi

from apps.graph.api import ConceptResource, GraphResource, ConceptResourceResource, DependencyResource, GoalResource,\
    TargetGraphResource, FullTargetGraphResource, GlobalResourceResource, ResourceLocationResource
from views import *

# api v1
v1_api = NamespacedApi(api_name='v1', urlconf_namespace='graphs')
v1_api.register(ConceptResource())
v1_api.register(ConceptResourceResource())
v1_api.register(GlobalResourceResource())
v1_api.register(ResourceLocationResource())
v1_api.register(GraphResource())
v1_api.register(TargetGraphResource())
v1_api.register(FullTargetGraphResource())
v1_api.register(DependencyResource())
v1_api.register(GoalResource())

#import pdb; pdb.set_trace()

# TODO refactor concepts
urlpatterns = patterns(
    '',
    url(r'^$', "django.views.defaults.page_not_found"),
    url(r'^concept-triplet/?$', get_concept_triplet, name='concept_triplet'),
    url(r'^autocomplete/?$', get_autocomplete, name='autocomplete'),
    url(r'^(?i)concepts/([^/]+)/history/?$',
        get_concept_history,
        name="concept-history"),
Ejemplo n.º 10
0
            "message": ALL,
            "url": ALL,
        }
        authorization = ProgramScheduleAuthorization()
        validation = ProgramScheduleValidation()
        serializer = SetTopBoxSerializer(formats=['json'])
        authentication = MultiAuthentication(
            ApiKeyAuthentication(),
            BasicAuthentication(realm='cianet-middleware'),
            Authentication(),)


class SetTopBoxBehaviorFlagResource(NamespacedModelResource):

    class Meta:
        SetTopBoxBehaviorFlag = apps.get_model('client', 'SetTopBoxBehaviorFlag')
        queryset = SetTopBoxBehaviorFlag.objects.all()


api = NamespacedApi(api_name='v1', urlconf_namespace='client_v1')
api.register(SetTopBoxResource())
api.register(SetTopBoxParameterResource())
api.register(SetTopBoxChannelResource())
api.register(SetTopBoxConfigResource())
api.register(APIKeyResource())
api.register(SetTopBoxMessage())
api.register(SetTopBoxProgramScheduleResource())
api.register(SetTopBoxBehaviorFlagResource())

apis = [api]
Ejemplo n.º 11
0
from django.conf.urls import patterns, include

from tastypie.api import NamespacedApi

from .api import SightingResource, TreeResource, MarkerResource


v1_api = NamespacedApi(api_name='v1', urlconf_namespace='api')
v1_api.register(TreeResource())
v1_api.register(MarkerResource())
v1_api.register(SightingResource())

urlpatterns = patterns(
    '',
    (r'', include(v1_api.urls)),
)
Ejemplo n.º 12
0
from django.conf.urls import patterns, url, include
from tastypie.api import NamespacedApi
from . import api
from narrative import views


narrative_api = NamespacedApi(api_name='api', urlconf_namespace='narrative')
narrative_api.register(api.DatumResource())

urlpatterns = patterns(
    '',
    url(r'^log/$', views.LogView.as_view(), name='narrative.log'),
    url(r'^', include(narrative_api.urls, namespace='narrative'))
)
Ejemplo n.º 13
0
from django.conf.urls import patterns, include, url
from .api import GameResource
from tastypie.api import NamespacedApi

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='games')
v1_api.register(GameResource())

urlpatterns = patterns(
    '',
    url(r'^api/', include(v1_api.urls)),
)
Ejemplo n.º 14
0
def topic_models(path, force=False):
    """
        Auto-discover topic-related model by looking into
        a topic package for an ontology file. This will also
        create all api resources and endpoints.

        This will create the following modules:
            {path}
            {path}.models
            {path}.resources
            {path}.summary
            {path}.urls
    """
    # Clean the topic virtual instances from sys.module
    if force: clean_topic(path)
    topic_module = import_or_create(path, force=force)
    topic_name = path.split(".")[-1]
    # Ensure that the topic's model exist
    topic = Topic.objects.get(ontology_as_mod=topic_name)
    app_label = topic.app_label()
    reload_models(app_label)
    # Add '.models to the path if needed
    models_path = path if path.endswith(".models") else '%s.models' % path
    urls_path = "%s.urls" % path
    # Import or create virtually the models.py file
    models_module = import_or_create(models_path, force=force)
    try:
        # Generates all model using the ontology file.
        # Also overides the default app label to allow data persistance
        if topic.ontology_as_json is not None:
            # JSON ontology
            models = parser.json.parse(topic.ontology_as_json,
                                       path,
                                       app_label=app_label)
        elif topic.ontology_as_owl is not None:
            # OWL ontology
            models = parser.owl.parse(topic.ontology_as_owl,
                                      path,
                                      app_label=app_label)
        else:
            models = []
    # except TypeError as e:
    #    if settings.DEBUG: print 'TypeError:', e
    #    models = []
    except ValueError as e:
        if settings.DEBUG: print 'ValueError:', e
        models = []
    # Makes every model available through this module
    for m in models:
        # Record the model
        setattr(models_module, m, models[m])
    # Generates the API endpoints
    api = NamespacedApi(api_name='v1', urlconf_namespace=app_label)
    # Create resources root if needed
    resources = import_or_create("%s.resources" % path, force=force)
    # Creates a resource for each model
    for name in models:
        Resource = utils.create_model_resource(models[name])
        resource_name = "%sResource" % name
        # Register the virtual resource to by importa
        resource_path = "%s.resources.%s" % (path, resource_name)
        # This resource is now available everywhere:
        #  * as an attribute of `resources`
        #  * as a module
        setattr(resources, resource_name, Resource)
        # And register it into the API instance
        api.register(Resource())
    # Every app have to instance a SummaryResource class
    summary_path = "%s.summary" % path
    summary_module = import_or_create(summary_path, force=force)
    # Take the existing summary resource
    if hasattr(summary_module, 'SummaryResource'):
        SummaryResource = summary_module.SummaryResource
    # We create one if it doesn't exist
    else:
        from app.detective.topics.common.summary import SummaryResource as CommonSummaryResource
        attrs = dict(meta=CommonSummaryResource.Meta)
        SummaryResource = type('SummaryResource', (CommonSummaryResource, ),
                               attrs)
    # Register the summary resource
    api.register(SummaryResource())
    # Create url patterns
    urlpatterns = patterns(
        path,
        url('', include(api.urls)),
    )
    # Import or create virtually the url path
    urls_modules = import_or_create(urls_path, force=force)
    # Merge the two url patterns if needed
    if hasattr(urls_modules, "urlpatterns"):
        urlpatterns += urls_modules.urlpatterns
    # Update the current url pattern
    urls_modules.urlpatterns = urlpatterns
    # API is now up and running,
    # we need to connect its url patterns to global one
    urls = importlib.import_module("app.detective.urls")
    # Add api url pattern with the highest priority
    new_patterns = patterns(
        app_label,
        url(r'^{0}/{1}/'.format(topic.author, topic.slug),
            include(urls_path, namespace=app_label)),
    )
    if hasattr(urls, "urlpatterns"):
        # Merge with a filtered version of the urlpattern to avoid duplicates
        new_patterns += [
            u for u in urls.urlpatterns
            if getattr(u, "namespace", None) != app_label
        ]
    # Then update url pattern
    urls.urlpatterns = new_patterns
    # At last, force the url resolver to reload (because we update it)
    clear_url_caches()
    reload_urlconf()
    topic_module.__name__ = path
    sys.modules[path] = topic_module

    return topic_module
Ejemplo n.º 15
0
from django.conf.urls import patterns, include, url
from django.views.generic import DetailView, ListView
from django.views.generic import TemplateView
from todo.models import TodoItem, TodoList
from todo.api import TodoListResource, UserResource
from tastypie.api import Api, NamespacedApi

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='tastypie_api')
v1_api.register(UserResource())
v1_api.register(TodoListResource())

urlpatterns = patterns('',
    url(r'^$', 'todo.views.list_index', name='list_index'),
    url(r'^create/$', 'todo.views.list_create', name='list_create'),
    url(r'^delete/(?P<todolist_id>\d+)/$', 'todo.views.list_delete', name='list_delete'),
    url(r'^share/(?P<todolist_id>\d+)/$', 'todo.views.list_share', name='list_share'),
    url(r'^(?P<todolist_id>\d+)/items/$', 'todo.views.item_index', name='item_index'),
    url(r'^items/(?P<pk>\d+)/$',
        DetailView.as_view(
            model=TodoItem,
            template_name='todo/item_detail.html'),
        name='item_detail'),
    url(r'^(?P<todolist_id>\d+)/items/create/$', 'todo.views.item_create', name='item_create'),
    url(r'^items/(?P<todoitem_id>\d+)/update/$', 'todo.views.item_update', name='item_update'),
    url(r'^items/(?P<todoitem_id>\d+)/delete/$', 'todo.views.item_delete', name='item_delete'),
    url(r'^items/(?P<todoitem_id>\d+)/do/$', 'todo.views.item_do', name='item_do'),
    url(r'^denied$', TemplateView.as_view(template_name='todo/permitions_denied.html'), name='permitions_denied'),
    url(r'^api_tastypie/', include(v1_api.urls, namespace='tastypie_api')),
)
Ejemplo n.º 16
0
from django.conf.urls import patterns, url, include
from django.views.decorators.csrf import csrf_exempt

from speeches.views import *
from speeches.search import InstanceSearchView
from speeches.views import Select2AutoResponseView

try:
    from tastypie.api import NamespacedApi
    from speeches.api import SpeechResource, SpeakerResource, SectionResource
    # XXX The below assumes this app is being included with a 'speeches' namespace.
    # Unclear how to have this inherit whichever namespace is being used.
    v01_api = NamespacedApi(api_name='v0.1', urlconf_namespace='speeches')
    v01_api.register(SpeakerResource())
    v01_api.register(SpeechResource())
    v01_api.register(SectionResource())
except:
    v01_api = None

urlpatterns = patterns(
    '',
    url(r'^$', InstanceView.as_view(), name='home'),

    # Override the usual AutoResponseView from django_select2 so as to limit
    # results by instance
    url(r"^select2/fields/auto.json$",
        Select2AutoResponseView.as_view(),
        name="django_select2_central_json"),
    url(r'^(?P<path>speaker|recording)/?$', AddAnSRedirectView.as_view()),
    url(r'^(?P<path>speech)/?$', AddAnSRedirectView.as_view(suffix='es')),
    url(r'^search/',
Ejemplo n.º 17
0
  ),

  url(r'^about/$', BaseView.as_view(
      metadata='metadata/about.html'),
      name='about'
  ),

  url(r'^hut/new/$', BaseView.as_view(
      metadata='metadata/hut_new.html'),
      name='hut_new'
  ),

  url(r'^partials/(?P<template>\w+)\.html$', DynamicTemplateView.as_view(folder='partials')),
)

# api
v1_api = NamespacedApi(api_name='v1', urlconf_namespace='huts_api')
v1_api.register(RegionResource())
v1_api.register(DesignationResource())
v1_api.register(SystemResource())
v1_api.register(AccessTypeResource())
v1_api.register(HutTypeResource())
v1_api.register(ServiceResource())
v1_api.register(AgencyResource())
v1_api.register(HutResource())
v1_api.register(HutSuggestionResource())

api_patterns = patterns('',
  url(r'', include(v1_api.urls)),
)
Ejemplo n.º 18
0
from django.conf.urls import patterns, include, url
from tastypie.api import NamespacedApi
from cdos.resource import SoftwareResource, ImageResource, UserResource

api = NamespacedApi(urlconf_namespace="cdos")
api.register(SoftwareResource())
api.register(ImageResource())
api.register(UserResource())

urlpatterns = patterns('',
               url(r'^api/', include(api.urls)),
)
Ejemplo n.º 19
0
"""
Djukebox URLs
"""

from django.conf.urls.defaults import patterns, url, include
from tastypie.api import NamespacedApi

from models import Mp3File, OggFile
from api import ArtistResource, AlbumResource, TrackResource, TrackAlbumResource

# There must be a better way
v1_api = NamespacedApi(api_name='v1', urlconf_namespace='djukeboxapi')
v1_api.register(ArtistResource())
v1_api.register(AlbumResource())
v1_api.register(TrackResource())
v1_api.register(TrackAlbumResource())

urlpatterns = patterns('',
                       url(r'^api/', include(v1_api.urls)),
                       url(r'^login/', 'django.contrib.auth.views.login', {'template_name': 'djukebox/login.html'}, name='djukebox-login'),
                       url(r'^logout/', 'django.contrib.auth.views.logout_then_login', name="djukebox-logout"),
                       )

urlpatterns += patterns('djukebox.views',
                       url(r'^home/', 'main', name='djukebox-home'),
                       # the following stream_list/ cannot be used directly, but can be used by {% url %} tags in
                       # templated javascript to get the base url when you don't know the track id yet
                       url(r'^stream/(?P<format>\w+)/(?P<track_id>\d+)/', 'stream_track', name='djukebox-stream'),
                       url(r'^stream/ogg/(?P<track_id>\d+)/', 'stream_track', {'format': OggFile}, name='djukebox-stream-ogg'),
                       url(r'^stream/mp3/(?P<track_id>\d+)/', 'stream_track', {'format': Mp3File}, name='djukebox-stream-mp3'),
                       url(r'^upload_track/', 'upload_track', name='djukebox-upload'),
Ejemplo n.º 20
0
from api.resources import TaskResource
from api.resources import BasicAuthTaskResource

from api.resources import SprintMeetingResource
from api.resources import SprintDateResource

from api.resources import TeamResource
from api.resources import TeamAttrResource

from api.resources import UserResource
from api.resources import UserPreferencesResource
from api.resources import BasicAuthUserResource


v1_api = NamespacedApi(api_name='v1', urlconf_namespace="api")
v1_api.register(CustomerResource())
v1_api.register(ProjectResource())
v1_api.register(TaskResource())
v1_api.register(BasicAuthTaskResource())
v1_api.register(SprintDateResource())
v1_api.register(SprintMeetingResource())
v1_api.register(UserResource())
v1_api.register(UserPreferencesResource())
v1_api.register(BasicAuthUserResource())
v1_api.register(TeamResource())
v1_api.register(TeamAttrResource())

urlpatterns = patterns('',
  url(r'', include(v1_api.urls, namespace='api')),
)
Ejemplo n.º 21
0
        return not bundle.request.user.is_anonymous()


class MyChannelResource(NamespacedModelResource):
    source = fields.CharField(blank=True)

    class Meta:
        Channel = apps.get_model('tv', 'Channel')
        queryset = Channel.objects.filter(enabled=True, source__isnull=False)
        # excludes = ['enabled', 'description', 'enabled', 'name']
        fields = ['id', 'channelid', 'number', 'buffer_size']
        allowed_methods = ['get']
        resource_name = 'userchannel'
        authorization = MyChannelResourceAuthorization()
        authentication = MultiAuthentication(
            BasicAuthentication(realm='cianet-middleware'),
            SessionAuthentication(), Authentication(), ApiKeyAuthentication())

    def dehydrate_source(self, bundle):
        return '%s:%d' % (bundle.obj.source.ip, bundle.obj.source.port)


api_v1 = NamespacedApi(api_name='v1', urlconf_namespace='tv_v1')
api_v1.register(ChannelResource())

api_v2 = NamespacedApi(api_name='v2', urlconf_namespace='tv_v2')
api_v2.register(AllChannelResource())
api_v2.register(MyChannelResource())

apis = [api_v1, api_v2]
Ejemplo n.º 22
0
from tastypie.api import NamespacedApi

from resources import DocumentationResource
from resources import CategoryResource

v1_api = NamespacedApi(api_name='v1')

v1_api.register(DocumentationResource())
v1_api.register(CategoryResource())
Ejemplo n.º 23
0
from __future__ import absolute_import
from django.conf.urls import patterns, url, include

from . import views
from tastypie.api import NamespacedApi
from oauth2 import resource

api = NamespacedApi('v1', urlconf_namespace='oauth2')
api.register(resource.AccessTokenResource())
api.register(resource.UserResource())

urlpatterns = patterns(
    '',
    url(r'^authorize/$', views.AuthorizationView.as_view(), name="authorize"),
    url(r'^token/$', views.TokenView.as_view(), name="token"),
    url(r'^me/$', views.me_view, name='me'),
    url(r'^api/', include(api.urls)),
)

# Application management views
urlpatterns += patterns(
    '',
    url(r'^applications/$', views.ApplicationList.as_view(), name="list"),
    url(r'^applications/register/$', views.ApplicationRegistration.as_view(), name="register"),
    url(r'^applications/(?P<pk>\d+)/$', views.ApplicationDetail.as_view(), name="detail"),
    url(r'^applications/(?P<pk>\d+)/delete/$', views.ApplicationDelete.as_view(), name="delete"),
    url(r'^applications/(?P<pk>\d+)/update/$', views.ApplicationUpdate.as_view(), name="update"),
    url(r'^applications/(?P<pk>\d+)/examine/$', views.ApplicationExamine.as_view(), name='examine'),
)
Ejemplo n.º 24
0
from tastypie.api import NamespacedApi

from star_wars.api_resources import peopleresource

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='v1_apis')
v1_api.register(peopleresource.PeopleResource())
Ejemplo n.º 25
0
from django.conf.urls import patterns, include, url

from tastypie.api import NamespacedApi

from .api import EmployeeResource, SettingResource

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='')
v1_api.register(EmployeeResource())
v1_api.register(SettingResource())

urlpatterns = patterns('',
    url(r'^api/', include(v1_api.urls)),
)
Ejemplo n.º 26
0
from django.conf import settings
from django.conf.urls import include, url
from tastypie.api import NamespacedApi
from namespaced.api.resources import NamespacedNoteResource, NamespacedUserResource


api = NamespacedApi(api_name='v1', urlconf_namespace='special')
api.register(NamespacedNoteResource(), canonical=True)
api.register(NamespacedUserResource(), canonical=True)

if settings.DJANGO_VERSION >= settings.DJANGO_19:
    included = include((api.urls, 'special'))
else:
    included = include(api.urls, namespace='special')

urlpatterns = [
    url(r'^api/', included),
]
Ejemplo n.º 27
0
from .resources       import QuoteRequestResource, TopicNestedResource, \
                             TopicSkeletonResource, ArticleResource, \
                             SubscriptionResource, TopicDataSetResource
from .summary         import SummaryResource
from .user            import UserNestedResource, ProfileResource
from .cypher          import CypherResource
from django.conf.urls import patterns, include, url
from tastypie.api     import NamespacedApi
from .jobs            import JobResource

api = NamespacedApi(api_name='v1', urlconf_namespace='common')
api.register(QuoteRequestResource())
api.register(TopicNestedResource())
api.register(TopicSkeletonResource())
api.register(TopicDataSetResource())
api.register(SummaryResource())
api.register(CypherResource())
api.register(ProfileResource())
api.register(UserNestedResource())
api.register(ArticleResource())
api.register(JobResource())
api.register(SubscriptionResource())

urlpatterns = patterns('common',
    url(r'', include(api.urls)),
)

Ejemplo n.º 28
0
from django.conf.urls import url, include
from django.views.decorators.cache import cache_page
from tastypie.api import NamespacedApi
from status.api import IncidentResource, StatusResource
from status.models import Incident
from status.views import (DashboardView, HomeView, IncidentArchiveMonthView,
                          IncidentArchiveYearView, IncidentDeleteView,
                          IncidentDetailView, IncidentUpdateUpdateView,
                          create_incident, IncidentHideView,
                          HiddenDashboardView)

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='status')
v1_api.register(StatusResource())
v1_api.register(IncidentResource())

urlpatterns = [
    url(r'^api/', include(v1_api.urls)),
    url(r'^$', cache_page(15)(HomeView.as_view()), name='home'),
    url(r'^dashboard/$', DashboardView.as_view(), name='dashboard'),
    url(r'^dashboard/hidden/$',
        HiddenDashboardView.as_view(),
        name='dashboard_hidden'),
    url(r'^incident/new/$', create_incident, name='incident_create'),
    url(r'^incident/(?P<pk>\d+)/$',
        IncidentDetailView.as_view(model=Incident),
        name='incident_detail'),
    url(r'^incident/(?P<pk>\d+)/update/$',
        IncidentUpdateUpdateView.as_view(),
        name='incident_update'),
    url(r'^incident/(?P<pk>\d+)/hide/$',
        IncidentHideView.as_view(),
Ejemplo n.º 29
0
from django.conf.urls import patterns, include, url
from tastypie.api import NamespacedApi
from account import resource

api = NamespacedApi('v1', urlconf_namespace='account')
api.register(resource.UserResource())
api.register(resource.UserProfileResource())
api.register(resource.GroupResource())


urlpatterns = patterns('account.views',
    # Examples:
    url(r'^new/$', 'new_view', name='new'),
    url(r'^signin/$', 'signin_view', name='signin'),
    url(r'^signout/$', 'signout_view', name='signout'),
    url(r'^signup/$', 'signup_view', name='signup'),
    url(r'^forget/(?P<token>.*)$', 'forget_view', name='forget'),

    url(r'^auth-manager/$', 'auth_manager_view', name='auth_manager'),
    url(r'^setting/security/(?P<tab>\w+)/$', 'security_view', name='security'),
    url(r'^group/$', 'group_view', name='group'),
    url(r'^group/(?P<pk>.+)/user/$', 'group_user_view', name='group_user'),
    url(r'^group/add/$', 'group_add_view', name='add_group'),
    url(r'^group/detail/(?P<pk>.+)/$', 'group_detail_view', name='group_detail'),
    url(r'^setting/(?P<tab>.+)/$', 'setting_view', name='setting'),

    url(r'^active/(?P<token>.+)/$', 'active_view', name='active'),
    url(r'^$', 'home_view', name='home'),

    url(r'^api/', include(api.urls)),
Ejemplo n.º 30
0
from tastypie.api import NamespacedApi

from resources import DocumentationResource
from resources import CategoryResource


v1_api = NamespacedApi(api_name='v1')

v1_api.register(DocumentationResource())
v1_api.register(CategoryResource())
Ejemplo n.º 31
0
from .resources       import *
from django.conf.urls import patterns, include, url
from tastypie.api     import NamespacedApi

api = NamespacedApi(api_name='v1', urlconf_namespace='energy')
api.register(SummaryResource())
api.register(AmountResource())
api.register(CommentaryResource())
api.register(CountryResource())
api.register(DistributionResource())
api.register(FundraisingRoundResource())
api.register(OrganizationResource())
api.register(PersonResource())
api.register(PriceResource())
api.register(RevenueResource())
api.register(EnergyProductResource())
api.register(EnergyProjectResource())

urlpatterns = patterns('energy',
    url(r'', include(api.urls)),
)
Ejemplo n.º 32
0
from django.conf.urls import patterns, url, include

from tastypie.api import NamespacedApi

from apps.graph.api import ConceptResource, GraphResource, ConceptResourceResource, DependencyResource, GoalResource,\
    TargetGraphResource, FullTargetGraphResource, GlobalResourceResource, ResourceLocationResource
from views import *

# api v1
v1_api = NamespacedApi(api_name='v1', urlconf_namespace='graphs')
v1_api.register(ConceptResource())
v1_api.register(ConceptResourceResource())
v1_api.register(GlobalResourceResource())
v1_api.register(ResourceLocationResource())
v1_api.register(GraphResource())
v1_api.register(TargetGraphResource())
v1_api.register(FullTargetGraphResource())
v1_api.register(DependencyResource())
v1_api.register(GoalResource())

#import pdb; pdb.set_trace()

# TODO refactor concepts
urlpatterns = patterns('',
                       url(r'^$', "django.views.defaults.page_not_found"),
                       url(r'^concept-triplet/?$', get_concept_triplet, name='concept_triplet'),
                       url(r'^autocomplete/?$', get_autocomplete, name='autocomplete'),
                       url(r'^(?i)concepts/([^/]+)/history/?$', get_concept_history, name="concept-history"),
                       url(r'^(?i)concepts/([^/]+)/?$', get_concept_dep_graph, name="concepts"),
                       url(r'^(?i)concepts/$', "django.views.defaults.page_not_found", name="concepts-base"),
                       #                  url(r'^(?i)concepts/([^/]+)?/version/(\d+)/?$', get_concept_version, name="concept-version"),
Ejemplo n.º 33
0
from django.urls import path, include
from django.conf import settings
from django.conf.urls.static import static
from django.contrib.auth import views as auth_views
from tastypie.api import NamespacedApi

from .resources import ServiceResource, ImageResource, CompanyResource, CommentResource, ApiKeyResource, UserResource
from . import views

app_name = 'viciapp'

v1_api = NamespacedApi(api_name='v1', urlconf_namespace=app_name)
v1_api.register(ServiceResource())
v1_api.register(UserResource())
v1_api.register(ImageResource())
v1_api.register(CompanyResource())
v1_api.register(CommentResource())
v1_api.register(ApiKeyResource())

urlpatterns = [
    # Main pages
    path('', views.index, name='index'),
    path('about/', views.about, name='about'),
    path('login/', views.login_view, name='login'),
    path('logout/', views.logout, name='logout'),
    path('edit_profile/', views.edit_profile, name='edit_profile'),
    path('terms_and_conditions/', views.tac, name='terms_and_conditions'),
    # Processing pages
    path('login_process/', views.login_process, name='login_process'),
    # path('edit_profile_process/', views.edit_profile_process, name='edit_profile_process'),
Ejemplo n.º 34
0
    SpeechDelete, SpeechView, SpeakerCreate, SpeakerUpdate, SpeakerDelete, SpeakerSubscribe,
    SpeakerView, SpeakerList, SectionCreate, SectionUpdate, SectionDelete,
    SectionView, SectionViewAN, ParentlessList, RecordingList, RecordingView,
    RecordingUpdate, RecordingAPICreate, InstanceView, Select2AutoResponseView,
    PopoloImportView, AkomaNtosoImportView,
    )

from speeches.search import InstanceSearchView

try:
    from tastypie.api import NamespacedApi
    from speeches.api import SpeechResource, SpeakerResource, SectionResource
    # XXX The below assumes this app is being included with a 'speeches' namespace.
    # Unclear how to have this inherit whichever namespace is being used.
    v01_api = NamespacedApi(api_name='v0.1', urlconf_namespace='speeches')
    v01_api.register(SpeakerResource())
    v01_api.register(SpeechResource())
    v01_api.register(SectionResource())
except:
    v01_api = None

urlpatterns = [
    url(r'^$', InstanceView.as_view(), name='home'),

    # Override the usual AutoResponseView from django_select2 so as to limit
    # results by instance
    url(r"^select2/fields/auto.json$",
        Select2AutoResponseView.as_view(),
        name="django_select2_central_json"),

    url(r'^(?P<path>speaker|recording)/?$', AddAnSRedirectView.as_view()),
Ejemplo n.º 35
0
from .resources import *
from django.conf.urls import patterns, include, url
from tastypie.api import NamespacedApi

api = NamespacedApi(api_name='v1', urlconf_namespace='energy')
api.register(SummaryResource())
api.register(AmountResource())
api.register(CommentaryResource())
api.register(CountryResource())
api.register(DistributionResource())
api.register(FundraisingRoundResource())
api.register(OrganizationResource())
api.register(PersonResource())
api.register(PriceResource())
api.register(RevenueResource())
api.register(EnergyProductResource())
api.register(EnergyProjectResource())

urlpatterns = patterns(
    'energy',
    url(r'', include(api.urls)),
)
Ejemplo n.º 36
0
from django.conf.urls import include, url
from tastypie.api import NamespacedApi
from namespaced.api.resources import NamespacedNoteResource, NamespacedUserResource

api = NamespacedApi(api_name='v1', urlconf_namespace='special')
api.register(NamespacedNoteResource(), canonical=True)
api.register(NamespacedUserResource(), canonical=True)

urlpatterns = [
    url(r'^api/', include(api.urls, namespace='special')),
]
Ejemplo n.º 37
0
from django.conf.urls import patterns, include

from tastypie.api import NamespacedApi

from .api import SightingResource, TreeResource, MarkerResource

v1_api = NamespacedApi(api_name='v1', urlconf_namespace='api')
v1_api.register(TreeResource())
v1_api.register(MarkerResource())
v1_api.register(SightingResource())

urlpatterns = patterns(
    '',
    (r'', include(v1_api.urls)),
)