def _resolve_urlpatterns(self, urlpatterns, test_paths, allowed=None):
        factory = APIRequestFactory()
        try:
            urlpatterns = format_suffix_patterns(urlpatterns, allowed=allowed)
        except Exception:
            self.fail("Failed to apply `format_suffix_patterns` on  the supplied urlpatterns")
        resolver = make_url_resolver(r'^/', urlpatterns)
        for test_path in test_paths:
            try:
                test_path, expected_resolved = test_path
            except (TypeError, ValueError):
                expected_resolved = True

            request = factory.get(test_path.path)
            try:
                callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)
            except Resolver404:
                callback, callback_args, callback_kwargs = (None, None, None)
                if expected_resolved:
                    raise
            except Exception:
                self.fail("Failed to resolve URL: %s" % request.path_info)

            if not expected_resolved:
                assert callback is None
                continue

            assert callback_args == test_path.args
            assert callback_kwargs == test_path.kwargs
Пример #2
0
    def get_urls(self):
        """
        Append non-viewset views to the urls
        generated by the original `get_urls` method.
        """
        # URLs for simple views
        ret = []
        for prefix, viewset, basename in self.registry:

            # Skip viewsets
            if issubclass(viewset, viewsets.ViewSetMixin):
                continue

            # URL regex
            regex = '{prefix}{trailing_slash}$'.format(
                prefix=prefix,
                trailing_slash=self.trailing_slash
            )

            # The view name has to have suffix "-list" due to specifics
            # of the DefaultRouter implementation.
            ret.append(url(
                regex, viewset.as_view(),
                name='{0}-list'.format(basename)
            ))

        # Format suffixes
        ret = format_suffix_patterns(ret, allowed=['json', 'html'])

        # Prepend URLs for viewsets and return
        return super(DefaultRouterWithSimpleViews, self).get_urls() + ret
    def test_trailing_slash(self):
        factory = APIRequestFactory()
        urlpatterns = format_suffix_patterns([
            url(r'^test/$', dummy_view),
        ])
        resolver = RegexURLResolver(r'^/', urlpatterns)

        test_paths = [
            (URLTestPath('/test.api', (), {'format': 'api'}), True),
            (URLTestPath('/test/.api', (), {'format': 'api'}), False),
            (URLTestPath('/test.api/', (), {'format': 'api'}), True),
        ]

        for test_path, expected_resolved in test_paths:
            request = factory.get(test_path.path)
            try:
                callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)
            except Resolver404:
                callback, callback_args, callback_kwargs = (None, None, None)
            if not expected_resolved:
                assert callback is None
                continue

            assert callback_args == test_path.args
            assert callback_kwargs == test_path.kwargs
Пример #4
0
def recommender_patterns():
    return format_suffix_patterns(patterns('',
                                           # TODO, should be listed in a higher level
                                           # url(r'^v1.6/$',
                                           #     views.APIRootView.as_view(),
                                           #     name="api_root"),
                                           url(r'^public/recommender/?$',
                                               views.RecommenderAPIView.as_view(
                                               ),
                                               name="recommender-recommender"),
                                           url(r'^public/events/?$',
                                               views.EventsAPIView.as_view(),
                                               name="recommender-events"),
                                           url(r'^private/items/?$',
                                               views.ItemsAPIView.as_view(),
                                               name="recommender-items"),
                                           url(r'^public/recommender/redirect/?$',
                                               views.recommended_item_redirect,
                                               name="recommender-redirect"),
                                           url(r'^private/keywords/?$',
                                               views.KeywordAPIView.as_view(),
                                               name="recommender-keywords"),
                                           url(r'^private/stick_lists/?$',
                                               views.RecommendStickListsAPIView.as_view(),
                                               name="recommender-stick_lists"),
                                           url(r'^private/recommender/custom_lists/?$',
                                               views.RecommendCustomListsAPIView.as_view(),
                                               name="recommender-custom_lists"),
                                           ))
Пример #5
0
    def get_urls(self):
        ret = []

        if self.include_root_view:
            root_url = url(r'^$', self.get_api_root_view(),
                           name=self.root_view_name)
            ret.append(root_url)
        for prefix, viewset, basename in self.registry:
            lookup = self.get_lookup_regex(viewset)
            lookup_list = self.get_lookup_regexes(viewset)
            if lookup_list:
                # lookup = lookups[0]
                lookup_list = [u'/'.join(k) for k in lookup_list]
            else:
                lookup_list = [u'']
            routes = self.get_routes(viewset)
            for route in routes:
                mapping = self.get_method_map(viewset, route.mapping)
                if not mapping:
                    continue
                for lookups in lookup_list:
                    regex = route.url.format(
                        prefix=prefix,
                        lookup=lookup,
                        lookups=lookups,
                        trailing_slash=self.trailing_slash,
                        extra=self.get_extra_lookup_regexes(route)
                    )
                    view = viewset.as_view(mapping, **route.initkwargs)
                    name = route.name.format(basename=basename)
                    ret.append(url(regex, view, name=name))
        if self.include_format_suffixes:
            ret = format_suffix_patterns(ret, allowed=['[a-z0-9]+'])
        return ret
 def _resolve_urlpatterns(self, urlpatterns, test_paths):
     factory = APIRequestFactory()
     try:
         urlpatterns = format_suffix_patterns(urlpatterns)
     except Exception:
         self.fail("Failed to apply `format_suffix_patterns` on  the supplied urlpatterns")
     resolver = urlresolvers.RegexURLResolver(r'^/', urlpatterns)
     for test_path in test_paths:
         request = factory.get(test_path.path)
         try:
             callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)
         except Exception:
             self.fail("Failed to resolve URL: %s" % request.path_info)
         self.assertEqual(callback_args, test_path.args)
         self.assertEqual(callback_kwargs, test_path.kwargs)
Пример #7
0
    def get_urls(self):
        """
        Generate the list of URL patterns, including a default root view
        for the API, and appending `.json` style format suffixes.
        """
        urls = super(DefaultRouter, self).get_urls()

        if self.include_root_view:
            view = self.get_api_root_view(schema_urls=urls)
            root_url = url(r'^$', view, name=self.root_view_name)
            urls.append(root_url)

        if self.include_format_suffixes:
            urls = format_suffix_patterns(urls)

        return urls
Пример #8
0
def search_patterns():
    return format_suffix_patterns(patterns('',
                                           # TODO, should be listed in a higher level
                                           # url(r'^v1.6/$',
                                           #     views.api_root,
                                           #     name="api_root"),
                                           url(r'^public/search/?$',
                                               views.ProductsSearch.as_view(),
                                               name="products-search"),
                                           url(r'^public/suggest/?$',
                                               views.QuerySuggest.as_view(),
                                               name="query-suggest"),
                                           url(r'^public/keywords/?$',
                                               views.Keywords.as_view(),
                                               name="keywords"),
                                           ))
Пример #9
0
    def get_urls(self):
        """
        Return a list of URL regexs, this extends the default by adding a
        {prefix}-list route that accepts a lookup url kwarg.
        """
        urls = super(MultiLookupRouter, self).get_urls()

        extra_urls = []
        for prefix, viewset, basename in self.registry:
            lookup_fields = getattr(viewset, 'lookup_fields', None)
            if lookup_fields:
                route = routers.Route(
                    url=r'^{prefix}/{lookup}{trailing_slash}$',
                    mapping={
                        'delete': 'destroy',
                        'get': 'list',
                        'post': 'create',
                    },
                    name='{basename}-list',
                    detail=False,
                    initkwargs={'suffix': 'List'})
                self.multi = True
                lookup = self.get_lookup_regex(viewset)
                # reset
                self.multi = False
                regex = route.url.format(
                    prefix=prefix,
                    lookup=lookup,
                    trailing_slash=self.trailing_slash)

                mapping = self.get_method_map(viewset, route.mapping)
                if not mapping:
                    continue
                initkwargs = route.initkwargs.copy()
                initkwargs.update({
                    'basename': basename,
                    'detail': route.detail,
                })
                view = viewset.as_view(mapping, **initkwargs)
                name = route.name.format(basename=basename)
                extra_urls.append(url(regex, view, name=name))

        if self.include_format_suffixes:
            extra_urls = format_suffix_patterns(extra_urls)
        urls.extend(extra_urls)
        return urls
Пример #10
0
    def get_urls(self):
        # Keep trailing slash value...
        trailing_slash = self.trailing_slash

        # Generate base URLs without format.
        base_urls = super(SubRouterWithFormat, self).get_urls()

        # Generate the same URLs, but forcing to omit the trailing_slash.
        self.trailing_slash = ''
        extra_urls = super(SubRouterWithFormat, self).get_urls()

        # Reset trailing slash and add format to our extra URLs.
        self.trailing_slash = trailing_slash
        extra_urls = format_suffix_patterns(extra_urls, suffix_required=True)

        # Return the addition of both lists of URLs.
        return base_urls + extra_urls
Пример #11
0
    def get_urls(self):
        """
        Generate the list of URL patterns, including a default root view
        for the API, and appending `.json` style format suffixes.
        """
        urls = []

        if self.include_root_view:
            root_url = url(r'^$', self.get_api_root_view(), name='api-root')
            urls.append(root_url)

        default_urls = super(DefaultRouter, self).get_urls()
        urls.extend(default_urls)

        if self.include_format_suffixes:
            urls = format_suffix_patterns(urls)

        return urls
Пример #12
0
    def get_urls(self):
        """
        Return the URL patterns handled by this router.

        Include a default root view for the API, and appending `.json` style
        format suffixes.
        """
        urls = []
        assert self.include_root_view
        assert self.include_format_suffixes
        root_url = url(
            r'^$', self.get_api_root_view(), name=self.root_view_name)
        urls.append(root_url)

        default_urls = super(DefaultRouter, self).get_urls()
        urls.extend(default_urls)

        # Add format suffix versions
        # Include special-case of view_features allowing .html as well
        furls = format_suffix_patterns(urls, allowed=self.allowed_ext)
        urls = []
        for u in furls:
            assert not isinstance(u, RegexURLResolver)
            match = (
                u.name == 'viewfeatures-detail' and
                'api|json' in u.regex.pattern)
            if match:
                pattern = u.regex.pattern.replace('api|json', 'api|json|html')
                view = u._callback or u._callback_str
                u = url(pattern, view, u.default_args, u.name)
            urls.append(u)

        # Add redirects for list views
        assert not self.trailing_slash
        redirect_urls = []
        for u in default_urls:
            if u.name.endswith('-list'):
                pattern = u.regex.pattern.replace('$', '/$')
                view = RedirectView.as_view(
                    pattern_name=u.name, permanent=False, query_string=True)
                redirect_urls.append(url(pattern, view))
        return urls + redirect_urls
Пример #13
0
def format_patterns(urlpatterns):
    "If a URL pattern ends in a slash, it should be able to be rendered as different types"
    suffixes = ['json', 'jsonld', 'jsonld-browse', 'ttl', 'ttl-browse']
    ret = []
    for urlpattern in urlpatterns:
        if isinstance(urlpattern, RegexURLPattern):
            pattern = urlpattern.regex.pattern
            is_empty = pattern == '^$'

            if is_empty or pattern.endswith('/$'):
                regex = '^' if is_empty else urlpattern.regex.pattern[:-2]
                view = urlpattern._callback or urlpattern._callback_str
                kwargs = urlpattern.default_args
                name = urlpattern.name

                stripped_url = url(regex, view, kwargs, name)

                ret.append(format_suffix_patterns([stripped_url], True, suffixes)[0])
        ret.append(urlpattern)
    return ret
Пример #14
0
    def get_root_urls(self, viewset, name):
        lookup = self.get_lookup_regex(viewset)
        routes = self.get_routes(viewset)
        urls = []
        for route in routes:
            pattern = route.url.format(
                prefix='',
                lookup=lookup,
                trailing_slash=self.trailing_slash,
            )

            # Remove leading slash from detail view URLs
            pattern = pattern.replace('/', '', 1)

            mapping = self.get_method_map(viewset, route.mapping)
            if not mapping:
                continue
            view = viewset.as_view(mapping, **route.initkwargs)
            urls.append(url(pattern, view, name=name))

        return format_suffix_patterns(urls)
Пример #15
0
 def get_urls(self):
     result = []
     
     for prefix, viewset, basename in self.registry:
         model = shortcuts.get_model(viewset)
         lookup = shortcuts.get_lookup_url_regex(shortcuts.get_lookup_field(viewset))
         routes = self.get_routes(viewset)
         for route in routes:
             mapping = self.get_method_map(viewset, route.mapping)
             
             if not mapping: continue
             
             kwargs = self.get_format_dict(model, None, prefix=prefix, lookup=lookup)
             regex = self.get_regex(shortcuts.url_format(route.url, **kwargs))
             view = viewset.as_view(mapping, **route.initkwargs)
             name = shortcuts.name_format(route.name, **kwargs)
             result.append(url(regex, view, name=name))
             
     result = format_suffix_patterns(result, allowed=self.format_suffixes)
     
     return result
    def test_trailing_slash(self):
        factory = APIRequestFactory()
        urlpatterns = format_suffix_patterns([url(r"^test/$", dummy_view)])
        resolver = urlresolvers.RegexURLResolver(r"^/", urlpatterns)

        test_paths = [
            (URLTestPath("/test.api", (), {"format": "api"}), True),
            (URLTestPath("/test/.api", (), {"format": "api"}), False),
            (URLTestPath("/test.api/", (), {"format": "api"}), True),
        ]

        for test_path, expected_resolved in test_paths:
            request = factory.get(test_path.path)
            try:
                callback, callback_args, callback_kwargs = resolver.resolve(request.path_info)
            except urlresolvers.Resolver404:
                callback, callback_args, callback_kwargs = (None, None, None)
            if not expected_resolved:
                assert callback is None
                continue

            print(test_path, callback, callback_args, callback_kwargs)
            assert callback_args == test_path.args
            assert callback_kwargs == test_path.kwargs
Пример #17
0
    validators=["flex", "ssv"],
    public=True,
    permission_classes=(permissions.AllowAny, ),
)

router = routers.SimpleRouter()

# router.register(r"category", views.CategoryViewSet, "Category")
# router.register(r"entry", views.EntryViewSet, "Entry")
router.register(r"operator", views.Operator_ViewSet, "Operator")
router.register(r"address", views.Address_ViewSet, "Address")
router.register(r"inspection", views.Inspection_ViewSet, "Inspection")
router.register(r"riskoperations", views.Risk_Factor_Operation_ViewSet,
                "RiskOperations")
router.register(r"riskanimals", views.Risk_Factor_Animal_ViewSet,
                "RiskAnimals")
router.register(r"association", views.Association_ViewSet, "Association")

# fmt: off
swaggerpatterns = [
    path("",
         schema_view.with_ui("swagger", cache_timeout=None),
         name="api-docs"),
]
# fmt: on

# urlpatterns = [format_suffix_patterns(router.urls + swaggerpatterns)
#                 # path(r'^__debug__, include(debug_toolbar.urls')
# ]
urlpatterns = format_suffix_patterns(router.urls + swaggerpatterns)
Пример #18
0
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import UserCreate, LoginView

app_name = 'userprofile'

urlpatterns = format_suffix_patterns({
    path('users/', UserCreate.as_view(), name=UserCreate.name),
    path('login/', LoginView.as_view(), name=LoginView.name),
})
Пример #19
0
from django.urls import path, include
from workouts import views
from rest_framework.urlpatterns import format_suffix_patterns


urlpatterns = format_suffix_patterns(
    [
        path("api/workouts/", views.WorkoutList.as_view(), name="workout-list"),
        path(
            "api/workouts/<int:pk>/",
            views.WorkoutDetail.as_view(),
            name="workout-detail",
        ),
        path(
            "api/workout-files/",
            views.WorkoutFileList.as_view(),
            name="workout-file-list",
        ),
        path(
            "api/workout-files/<int:pk>/",
            views.WorkoutFileDetail.as_view(),
            name="workoutfile-detail",
        ),
    ]
)
Пример #20
0
        return Response(ret)


router = routers.DefaultRouter()
router.APIRootView = RelativeUrlRootView

router.register(r'cases', CaseViewSet)
router.register(r'candidates', CandidateViewSet)
router.register(r'nodules', NoduleViewSet)
router.register(r'images', ImageSeriesViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework')),
    url(r'^images/available$',
        ImageAvailableApiView.as_view(),
        name='images-available'),
    url(r'^images/preview$',
        ImagePreviewApiView.as_view(),
        name='images-preview'),
    url(r'^candidates-info$', candidates_info, name='candidates-info'),
    url(r'^candidates/(?P<candidate_id>\d+)/move$',
        update_candidate_location,
        name='update-candidate-location'),
]

# Support different suffixes
urlpatterns += format_suffix_patterns(
    [url(r'^cases/(?P<pk>\d+)/report$', case_report, name='case-report')])
Пример #21
0
    ),
    url(
        r"^history/",
        include(("funkwhale_api.history.urls", "history"),
                namespace="history"),
    ),
    url(
        r"^users/",
        include(("funkwhale_api.users.api_urls", "users"), namespace="users"),
    ),
    url(
        r"^oauth/",
        include(("funkwhale_api.users.oauth.urls", "oauth"),
                namespace="oauth"),
    ),
    url(r"^token/?$", jwt_views.obtain_jwt_token, name="token"),
    url(r"^token/refresh/?$",
        jwt_views.refresh_jwt_token,
        name="token_refresh"),
    url(r"^rate-limit/?$",
        common_views.RateLimitView.as_view(),
        name="rate-limit"),
    url(r"^text-preview/?$",
        common_views.TextPreviewView.as_view(),
        name="text-preview"),
]

urlpatterns = [url(r"^v1/", include(
    (v1_patterns, "v1"), namespace="v1"))] + format_suffix_patterns(
        subsonic_router.urls, allowed=["view"])
Пример #22
0
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from notes import views

urlpatterns = format_suffix_patterns([
    path('', views.api_root),
    path('notes/', views.NoteList.as_view(),name='note-list'),
    path('notes/<int:pk>/', views.NoteDetail.as_view(),name='note-detail'),
    path('users/', views.UserList.as_view(),name='user-list'),
    path('users/<int:pk>/', views.UserDetail.as_view(),name='user-detail'),
    path('share/<int:note_id>/<int:viewer_id>/',views.shared_notes,name='note-share'),
])
Пример #23
0
# Importations
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns

from . import views

# URLs
urlpatterns = format_suffix_patterns([
    # Vues API
    path('login/', views.api_login),
    path('logout/', views.api_logout),
    path('authenticated/', views.is_authenticated),
])
Пример #24
0
from django.conf.urls import patterns, url

from rest_framework.urlpatterns import format_suffix_patterns
from . import views

urlpatterns = format_suffix_patterns(
    patterns(
        "",
        # url(r'^auth/', include('rest_framework.urls', namespace='rest_framework')),
        # url(r'^sites/', include('bluusites.api_urls', namespace='sites')),
        # url(r'^companies/', include('companies.api_urls', namespace='companies')),
        # url(r'^devices/', include('devices.api_urls', namespace='devices')),
        url(
            r"^sites/(?P<site_slug>[0-9\w.@+-]+)/devices/(?P<device_slug>[0-9\w.@+-]+)/statuses/",
            views.DeviceStatusCreateView.as_view(),
            name="create_status",
        ),
        url(r"^sites/(?P<site_slug>[0-9\w.@+-]+)/", views.SiteHeartBeatView.as_view(), name="site_heartbeat"),
    ),
    allowed=["json", "html"],
)
Пример #25
0
public_apis = format_suffix_patterns(patterns(
    '',
    url(r'^profile$', Profile.as_view(), name='profile'),

    url(r'^group$', GroupList.as_view(), name='group-list'),
    url(r'^group/(?P<groupname>.*)$', Group.as_view()),

    url(r'^tag$', TagList.as_view(), name='tag-list'),
    url(r'^tag/(?P<tag_slug>.*)$', Tag.as_view()),

    url(r'^application$',
        ApplicationList.as_view(),
        name='application-list'),

    url(r'^application/search$',
        ApplicationSearch.as_view(),
        name='application-search'),
    url(r'^application/(?P<app_uuid>%s)$' % uuid_match,
        Application.as_view(),
        name='application-detail'),
    #ApplicationThreshold Related APIs
    url(r'^application/(?P<app_uuid>%s)/threshold$' % uuid_match,
        ApplicationThresholdDetail.as_view(),
        name='threshold-detail'),

    url(r'^instance_history$', InstanceHistory.as_view(),
        name='instance-history'),
    url(r'^instance_history/'
        '(?P<instance_id>%s)$' % uuid_match, InstanceHistoryDetail.as_view(),
        name='instance-history'),
    url(r'^instance_history/'
        + '(?P<instance_id>%s)/' % uuid_match
        + 'status_history$', InstanceStatusHistoryDetail.as_view(),
        name='instance-history'),

    url(identity_specific + r'/instance/'
        + '(?P<instance_id>%s)/tag$' % uuid_match,
        InstanceTagList.as_view(), name='instance-tag-list'),
    url(identity_specific + r'/instance/'
        + '(?P<instance_id>%s)/tag/(?P<tag_slug>.*)$' % uuid_match,
        InstanceTagDetail.as_view(), name='instance-tag-detail'),
    url(identity_specific + r'/instance/'
        + '(?P<instance_id>%s)/action$' % uuid_match,
        InstanceAction.as_view(), name='instance-action'),
    url(identity_specific + r'/instance/(?P<instance_id>%s)$' % uuid_match,
        Instance.as_view(), name='instance-detail'),
    url(identity_specific + r'/instance$',
        InstanceList.as_view(), name='instance-list'),

    url(r'^instance_action/$',
        InstanceActionList.as_view(),
        name='instance-action-list'),
    url(r'^instance_action/(?P<action_id>%s)$' % (id_match,),
        InstanceActionDetail.as_view(),
        name='instance-action-detail'),

    url(identity_specific + r'/size$',
        SizeList.as_view(), name='size-list'),
    url(identity_specific + r'/size/(?P<size_id>%s)$' % (id_match,),
        Size.as_view(), name='size-detail'),


    url(identity_specific + r'/volume$',
        VolumeList.as_view(), name='volume-list'),
    url(identity_specific + r'/volume/(?P<volume_id>%s)$' % uuid_match,
        Volume.as_view(), name='volume-detail'),
    url(identity_specific + r'/boot_volume(?P<volume_id>%s)?$' % uuid_match,
        BootVolume.as_view(), name='boot-volume'),

    url(identity_specific + r'/volume_snapshot$',
        VolumeSnapshot.as_view(), name='volume-snapshot'),
    url(identity_specific + r'/volume_snapshot/(?P<snapshot_id>%s)$' % uuid_match,
        VolumeSnapshotDetail.as_view(), name='volume-snapshot-detail'),

    url(identity_specific + r'/machine$',
        MachineList.as_view(), name='machine-list'),
    url(identity_specific + r'/machine/history$',
        MachineHistory.as_view(), name='machine-history'),
    url(identity_specific + r'/machine/search$',
        MachineSearch.as_view(), name='machine-search'),
    url(identity_specific + r'/machine/(?P<machine_id>%s)$' % uuid_match,
        Machine.as_view(), name='machine-detail'),
    url(identity_specific + r'/machine/(?P<machine_id>%s)/license$' % uuid_match,
        MachineLicense.as_view(), name='machine-license'),
    url(identity_specific + r'/machine/(?P<machine_id>%s)' % uuid_match
        + '/icon$', MachineIcon.as_view(), name='machine-icon'),

    url(provider_specific + r'/identity$', IdentityList.as_view(), name='identity-list'),
    url(identity_specific + r'$', Identity.as_view(), name='identity-detail'),

    url(r'^credential$', CredentialList.as_view(),
        name='credential-list'),
    url(r'^credential/(?P<identity_uuid>%s)$' % (uuid_match,),
        CredentialDetail.as_view(), name='credential-detail'),

    url(r'^identity$', IdentityDetailList.as_view(),
        name='identity-detail-list'),
    url(r'^identity/(?P<identity_uuid>%s)$' % (uuid_match,), IdentityDetail.as_view(),
        name='identity-detail'),
    url(r'^provider$', ProviderList.as_view(), name='provider-list'),
    url(r'^provider/(?P<provider_uuid>%s)$' % uuid_match,
        Provider.as_view(), name='provider-detail'),


    url(identity_specific + r'/request_image$',
        MachineRequestList.as_view(), name='machine-request-list'),
    url(identity_specific + r'/request_image/(?P<machine_request_id>%s)$' % (uuid_match,),
        MachineRequest.as_view(), name='machine-request'),


    url(identity_specific + r'/profile$',
        Profile.as_view(), name='profile-detail'),

    url(identity_specific + r'/allocation_request$',
        AllocationRequestList.as_view(), name='allocation-request-list'),
    url(identity_specific +
        r'/allocation_request/(?P<allocation_request_uuid>%s)$' % uuid_match,
        AllocationRequestDetail.as_view(), name='allocation-request-detail'),

    url(r'^allocation$',
        AllocationList.as_view(), name='allocation-list'),
    url(r'^allocation/(?P<quota_id>%s)$' % (id_match,),
        AllocationDetail.as_view(), name='quota-detail'),

    url(r'^quota_request$',
        QuotaRequestList.as_view(), name='quota-request-list'),
    url(r'^quota_request/(?P<quota_request_uuid>%s)$' % uuid_match,
        QuotaRequestDetail.as_view(), name='quota-request-detail'),

    url(r'^quota$',
        QuotaList.as_view(), name='quota-list'),
    url(r'^quota/(?P<quota_id>%s)$' % (id_match,),
        QuotaDetail.as_view(), name='quota-detail'),


    url(r'^version$', Version.as_view()),
    url(r'^maintenance$',
        MaintenanceRecordList.as_view(),
        name='maintenance-record-list'),

    url(r'^license$',
        LicenseList.as_view(),
        name='license-list'),

    url(r'^license/(?P<license_id>%s)$' % uuid_match,
        License.as_view(),
        name='license-detail'),

    url(r'^monitoring$',
        MonitoringList.as_view(),
        name='monitoring-list'),

    url(r'^cloud_admin_imaging_request$',
        CloudAdminImagingRequestList.as_view(),
        name='cloud-admin-imaging-request-list'),
    url(r'^cloud_admin_imaging_request/(?P<machine_request_id>%s)$'
        % (id_match,),
        CloudAdminImagingRequest.as_view(),
        name='cloud-admin-imaging-request-detail'),
    url(r'^cloud_admin_imaging_request/(?P<machine_request_id>%s)/(?P<action>\w)$'
        % (id_match,),
        CloudAdminImagingRequest.as_view(),
        name='cloud-admin-imaging-request-detail'),

    url(r'^cloud_admin_account_list/$',
        CloudAdminAccountList.as_view(),
        name='cloud-admin-account-list'),
    url(r'^cloud_admin_account_list/(?P<username>%s)$'
        % (user_match,),
        CloudAdminAccount.as_view(),
        name='cloud-admin-account-detail'),
    url(r'^cloud_admin_instance_action/$',
        CloudAdminInstanceActionList.as_view(),
        name='cloud-admin-instance-action-list'),

    url(r'^cloud_admin_instance_action/(?P<provider_instance_action_id>%s)$' % (id_match,),
        CloudAdminInstanceAction.as_view(),
        name='cloud-admin-instance-action-detail'),

    url(r'^admin/quota$',
        CloudAdminQuotaList.as_view(),
        name='cloud-admin-quota-list'),
    url(r'^admin/quota/(?P<identifier>%s)$' % (uuid_match,),
        CloudAdminQuotaRequest.as_view(),
        name='cloud-admin-quota-detail'),

    url(r'^admin/allocation$',
        CloudAdminAllocationList.as_view(),
        name='cloud-admin-allocation-list'),
    url(r'^admin/allocation/(?P<identifier>%s)$' % (uuid_match,),
        CloudAdminAllocationRequest.as_view(),
        name='cloud-admin-allocation-detail'),

    url(identity_specific + r'/export_request$',
        ExportRequestList.as_view(), name='export-request-list'),
    url(identity_specific + r'/export_request/(?P<export_request_id>%s)$' % (id_match,),
        ExportRequest.as_view(), name='export-request'),

    url(identity_specific + r'/hypervisor$',
        HypervisorList.as_view(), name='hypervisor-list'),
    url(identity_specific + r'/hypervisor/(?P<hypervisor_id>%s)$' % (id_match,),
        HypervisorDetail.as_view(), name='hypervisor-detail'),

    url(identity_specific + r'/step$',
        StepList.as_view(), name='step-list'),
    url(identity_specific + r'/step/(?P<step_id>%s)$' % uuid_match,
        Step.as_view(), name='step-detail'),


    url(identity_specific + r'/machine/(?P<machine_id>%s)/vote$' % uuid_match,
        MachineVote.as_view(), name='machine-vote'),

    url(identity_specific + r'/meta$', Meta.as_view(), name='meta-detail'),
    url(identity_specific + r'/meta/(?P<action>.*)$',
        MetaAction.as_view(), name='meta-action'),

    url(identity_specific + r'/members$',
        IdentityMembershipList.as_view(), name='identity-membership-list'),
    url(identity_specific + r'/members/(?P<group_name>%s)$' % user_match,
        IdentityMembership.as_view(), name='identity-membership-detail'),

))
Пример #26
0
    'delete': 'destroy'
})

suggestion_list_detail = SuggestionListViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
})

urlpatterns = format_suffix_patterns(patterns('',
	url(r'^appUsers/facebook_id=(?P<facebook_id>[0-9]+)/$', app_user_detail, name='app_user_detail'),
	url(r'^appUserMemberships/facebook_id=(?P<app_user__facebook_id>[0-9]+)&app_facebook_id=(?P<mobile_app__facebook_id>[0-9]+)/$', app_user_membership_detail, name='app_user_membership_detail' ),
	url(r'^suggestionLists/facebook_id=(?P<app_user_membership__app_user__facebook_id>[0-9]+)&app_facebook_id=(?P<app_user_membership__mobile_app__facebook_id>[0-9]+)/$', suggestion_list_detail, name='suggestion_list_detail'),

    # URLS for Adam to use
    url(r'^appUserLogin/', AppUserLoginView.as_view(), name='app-user-login'),
    url(r'^suggestions/', SuggestionsView.as_view(), name='suggestions'),

    # Invitation redirect URL
    url(r'invitations/', InvitationsView.as_view(), name='invitations'),

    # REST api URL's
    url(r'^/api/register/', AppUserLoginView.as_view(), name='register'),
    url(r'^/api/friends/', SuggestionsView.as_view(), name='friends')
))

urlpatterns += patterns('',
	url(r'', include(router.urls)),
)
Пример #27
0
    url(r'^api/images/',
        include('django_core_models.images.urls')),
    url(r'^api/locations/',
        include('django_core_models.locations.urls')),
    url(r'^api/organizations/',
        include('django_core_models.organizations.urls')),
    url(r'^api/social-media/',
        include('django_core_models.social_media.urls')),
]

urlpatterns_api_contacts = [
    url(r'^api/contacts/', include('contacts.urls')),
]

urlpatterns_api = (urlpatterns_api_core_models +
                   urlpatterns_api_contacts +
                   urlpatterns_api_base)

urlpatterns_rest_framework = [
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework'))
    ]

urlpatterns = (format_suffix_patterns(urlpatterns_api) +
               urlpatterns +
               urlpatterns_rest_framework)

if settings.DEBUG:
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
Пример #28
0
announcement_list = AnnouncementViewSet.as_view({
    'get': 'list',
})

announcement_detail = AnnouncementViewSet.as_view({
    'get': 'retrieve',
})

post_list = PostViewSet.as_view({'get': 'list', 'post': 'create'})

post_detail = PostViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
})

urlpatterns = format_suffix_patterns(
    patterns(
        '',
        url(r'^category/$', category_list, name='category-list'),
        url(r'^category/(?P<pk>[0-9]+)/$',
            category_detail,
            name='category-detail'),
        url(r'^announcement/$', announcement_list, name='announcement-list'),
        url(r'^announcement/(?P<pk>[0-9]+)/$',
            announcement_detail,
            name='announcement-detail'),
        url(r'^post/$', post_list, name='post-list'),
        url(r'^post/(?P<pk>[0-9]+)/$', post_detail, name='post-detail'),
    ))
Пример #29
0
from django.conf.urls import url, include
from ciphertext import views
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = format_suffix_patterns([
    url(r'^$', views.api_root),
    url(r'^graph/$', views.api_graph),
    url(r'^ciphertext/$',
        views.CiphertextList.as_view(),
        name='ciphertext-list'),
    url(r'^ciphertext/(?P<pk>[0-9]+)/$',
        views.CiphertextDetail.as_view(),
        name='ciphertext-detail'),
    #    url(r'^users/$', views.UserList.as_view(), name='user-list'),
    #    url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view(), name='user-detail'),
])

# Login and logout views for the browsable API
#urlpatterns += [
#    url(r'^api-auth/', include('rest_framework.urls',
#                               namespace='rest_framework')),
#]
Пример #30
0
#from obis.views import SearchViewSet

router = routers.SimpleRouter()
router.register('acctax', AcctaxViewSet)
router.register('comtax', ComtaxViewSet)
router.register('syntax', SyntaxViewSet)
router.register('hightax', HightaxViewSet)
router.register('fedstatus', FedStatusViewSet)
router.register('ststatus', StStatusViewSet)
router.register('okswap', OkSwapViewSet)
router.register('occurrence', OccurrenceViewSet)
router.register('source', SourceViewSet)
router.register('institution', InstitutionViewSet)
router.register('county', CountyViewSet)
router.register('cotrs', CoTrsViewSet)
router.register('identificationverification',
                IdentificationVerificationViewSet)
router.register('rankchange', RankChangeViewSet)
router.register('spatialrefsys', SpatialRefSysViewSet)

# View
#router.register('vwsearch', VwSearchViewSet)
#router.register('vwsearchmv', VwSearchmvViewSet)

urlpatterns = patterns(
    '',
    url(r'^', include(router.urls)),
)
urlpatterns = format_suffix_patterns(
    urlpatterns, allowed=['api', 'json', 'jsonp', 'xml', 'yaml'])
Пример #31
0
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import PersonDetail, PersonList

urlpatterns = format_suffix_patterns([
    path("person/", PersonList.as_view(), name="person-list"),
    path("person/<int:pk>/", PersonDetail.as_view(), name="person-detail"),
])
Пример #32
0
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework import renderers
from front import views


viewpatterns = [

    url(r'^sendemail', views.send_mail_view, name='sendemail'),

    # --------------- Landing related ----------------
    url(r'^$', views.landing_view, name='landing'),

    # --------------- RestAPI  ---------------
    #url(r'rest/myjobs', views.MyJobsView.as_view()),
    #url(r'rest/room/(?P<jobId>\d+)/(?P<applicantId>\d+)/$', views.ChatRoomView.as_view()),

]

urlpatterns = format_suffix_patterns(viewpatterns)
Пример #33
0
urlpatterns = format_suffix_patterns([
    url(r'^$', views.api_root),
    url(r'documents$', views.DocumentList.as_view(),
        name='document-list'),
    url(r'^documents/(?P<pk>[0-9]+)$',
        views.DocumentDetail.as_view(),
        name='document-detail'),
    url(r'departments$', views.DepartmentList.as_view(),
        name='department-list'),
    url(r'^departments/(?P<pk>[0-9]+)$',
        views.DepartmentDetail.as_view(),
        name='department-detail'),
    url(r'usertypes$', views.UsertypeList.as_view(),
        name='usertype-list'),
    url(r'^usertype/(?P<pk>[0-9]+)$',
        views.UsertypeDetail.as_view(),
        name='usertype-detail'),
    url(r'users$', views.UserList.as_view(),
        name='user-list'),
    url(r'^user/(?P<pk>[0-9]+)$',
        views.UserDetail.as_view(),
        name='user-detail'),
    url(r'grants$', views.GrantList.as_view(),
        name='grant-list'),
    url(r'^grants/(?P<pk>[0-9]+)$',
        views.GrantDetail.as_view(),
        name='grant-detail'),
    # url(r'dynamicforms', views.DynamicformList.as_view(),
    #     name='dynamicform-list'),
    # url(r'^dynamicform/(?P<pk>[0-9]+)$',
    #     views.DynamicformDetail.as_view(),
    #     name='dynamicform-detail'),
])
Пример #34
0
#     # ex: /thermostats/5/settings/
#     url(r'^(?P<thermostat_id>\d+)/settings/$', views.settings, name='settings'),
#     # ex: /thermostats/5/temperature/
#     url(r'^(?P<thermostat_id>\d+)/temperature/$', views.temperature, name='temperature'),
# )

from django.conf.urls import patterns, url, include
from rest_framework.urlpatterns import format_suffix_patterns
from thermostats.views import ThermostatViewSet, UserViewSet
from rest_framework import renderers

# API endpoints
urlpatterns = format_suffix_patterns(patterns('thermostats.views',
    url(r'^$', 'api_root'),
    url(r'^thermostats/$', thermostat_list, name='thermostat-list'),
    url(r'^thermostats/(?P<pk>[0-9]+)/$', thermostat_detail, name='thermostat-detail'),
    url(r'^thermostats/(?P<pk>[0-9]+)/highlight/$', thermostat_highlight, name='thermostat-highlight'),
    url(r'^users/$', user_list, name='user-list'),
    url(r'^users/(?P<pk>[0-9]+)/$', user_detail, name='user-detail')
))

# Login and logout views for the browsable API
urlpatterns += patterns('',    
    url(r'^api-auth/', include('rest_framework.urls',
                               namespace='rest_framework')),
)

thermostat_list = ThermostatViewSet.as_view({
    'get': 'list',
    'post': 'create'
})
thermostat_detail = ThermostatViewSet.as_view({
Пример #35
0
from api.experiments import views as experiments_views
from api.jobs import views as jobs_views
from api.plugins import views as tensorboards_views
from api.projects import views
from constants.urls import NAME_PATTERN, USERNAME_PATTERN

projects_urlpatterns = [
    re_path(r'^projects/?$', views.ProjectCreateView.as_view()),
    re_path(r'^{}/?$'.format(USERNAME_PATTERN),
            views.ProjectListView.as_view()),
    re_path(r'^{}/{}/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            views.ProjectDetailView.as_view()),
    re_path(r'^{}/{}/groups/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            groups_views.ExperimentGroupListView.as_view()),
    re_path(r'^{}/{}/experiments/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            experiments_views.ProjectExperimentListView.as_view()),
    re_path(r'^{}/{}/jobs/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            jobs_views.ProjectJobListView.as_view()),
    re_path(r'^{}/{}/builds/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            builds_views.ProjectBuildListView.as_view()),
    re_path(r'^{}/{}/tensorboards/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            tensorboards_views.ProjectTensorboardListView.as_view()),
    re_path(r'^{}/{}/bookmark/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            bookmark_views.ProjectBookmarkCreateView.as_view()),
    re_path(r'^{}/{}/unbookmark/?$'.format(USERNAME_PATTERN, NAME_PATTERN),
            bookmark_views.ProjectBookmarkDeleteView.as_view()),
]

# Order is important, because the patterns could swallow other urls
urlpatterns = format_suffix_patterns(projects_urlpatterns)
Пример #36
0
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns

from . import views

urlpatterns = [
    url('^$', views.ApiRoot.as_view()),
    url('^export/badges/$',
        views.ExportBadgesView.as_view(),
        name='export-badges'),
    url('^export/instructors/$',
        views.ExportInstructorLocationsView.as_view(),
        name='export-instructors'),
    url('^events/published/$',
        views.PublishedEvents.as_view(),
        name='events-published'),
]

# for login-logout functionality
urlpatterns += [
    url(r'^api-auth/',
        include('rest_framework.urls', namespace='rest_framework')),
]

urlpatterns = format_suffix_patterns(urlpatterns)  # allow to specify format
Пример #37
0
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from snippets import views

#THIS ARE URLS WITH HYPERLINKED APIs,

urlpatterns = format_suffix_patterns([
    url(r'^$', views.api_root),
    url(r'^snippets/$', views.SnippetList.as_view(), name='snippet-list'),
    url(r'^snippets/(?P<pk>[0-9]+)/$',
        views.SnippetDetail.as_view(),
        name='snippet-detail'),
    url(r'^snippets/(?P<pk>[0-9]+)/highlight/$',
        views.SnippetHighlight.as_view(),
        name='snippet-highlight'),
    url(r'^users/$', views.UserList.as_view(), name='user-list'),
    url(r'^users/(?P<pk>[0-9]+)/$',
        views.UserDetail.as_view(),
        name='user-detail')
])
Пример #38
0
from django.conf.urls import patterns, url

from rest_framework.urlpatterns import format_suffix_patterns

from rfdocs import views_api

version_detail = views_api.RFLibraryViewSet.as_view({
    'get': 'retrieve'
})

library_list = views_api.RFLibraryViewSet.as_view({'get': 'list'})

library_version_detail = views_api.RFLibraryVersionViewSet.as_view({'get': 'retrieve'})

keyword_detail = views_api.RFKeywordViewSet.as_view({'get': 'retrieve'})

tag_detail = views_api.RFTagViewSet.as_view({'get': 'retrieve'})

urlpatterns = format_suffix_patterns(
    patterns('rfdocs.views_api',
             url(r'^$', library_list, name='rfversion-list'),
             url(r'^tag/(?P<slug>[-\w]+)/$', tag_detail, name='rftag_detail_api'),
             url(r'^(?P<slug>[-\w.]+)/$', version_detail, name='rflibrary_detail_api'),
             url(r'^(?P<library_slug>[-\w.]+)/(?P<slug>[-\w.]+)/$', library_version_detail,
                 name='rflibraryversion_detail_api'),
             url(r'^(?P<library_slug>[-\w.]+)/(?P<version_slug>[-\w.]+)/(?P<name>[-\w\s]+)/$',
                 keyword_detail,
                 name='rfkeyword_detail_api'),
             )
)
Пример #39
0
from apps.api import views

app_name = 'api'

v1_api = [
    url(r'^$', views.api_root, name='api_root'),
    url(r'^users$', views.UserList.as_view(), name='user_list'),
    url(r'^users/(?P<pk>-?\d+)$',
        views.UserDetail.as_view(),
        name='user_detail'),
    url(r'^lecturers$', views.LecturerList.as_view(), name='lecturer_list'),
    url(r'^lecturers/(?P<pk>-?\d+)$',
        views.LecturerDetail.as_view(),
        name='lecturer_detail'),
    url(r'^lecturers/(?P<pk>-?\d+)/rate$',
        views.LecturerRate.as_view(),
        name='lecturer_rate'),
    url(r'^quotes$', views.QuoteList.as_view(), name='quote_list'),
    url(r'^quotes/(?P<pk>-?\d+)$',
        views.QuoteDetail.as_view(),
        name='quote_detail'),
    url(r'^quotes/(?P<pk>-?\d+)/vote$',
        views.QuoteVote.as_view(),
        name='quote_vote'),
]

urlpatterns = [
    url(r'^', include('rest_framework.urls')),
    url(r'^v1/', include(format_suffix_patterns(v1_api))),
]
Пример #40
0
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns
from . import views

urlpatterns = [
    url(r'^proxies/$', views.ProxyList.as_view()),
    url(r'^proxies/(?P<pk>[0-9]+)/$', views.ProxyDetail.as_view()),
]

urlpatterns = format_suffix_patterns(urlpatterns)
Пример #41
0
from rest_framework.urlpatterns import format_suffix_patterns

from .views import SnippetViewSet, UserViewSet

snippet_list = SnippetViewSet.as_view({'get': 'list', 'post': 'create'})

snippet_detail = SnippetViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destory'
})

snippet_highlight = SnippetViewSet.as_view(
    {'get': 'highlight'}, renderer_classes=[renderers.StaticHTMLRenderer])

user_list = UserViewSet.as_view({'get': 'list'})

user_detail = UserViewSet.as_view({'get': 'retrieve'})

urlpatterns = format_suffix_patterns([
    # url(r'^$', api_root),
    path('snippets/', snippet_list, name='snippet-list'),
    path('snippets/<pk>/', snippet_detail, name='snippet-detail'),
    path('users/', user_list, name='user-list'),
    path('users/<pk>/', user_detail, name='user-detail'),
    path('snippets/<pk>/highlight/',
         snippet_highlight,
         name='snippet-highlight'),
])
Пример #42
0
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns

from .views import grapherEntityView

app_name = 'grapherEntities'


urlpatterns = [
]

urlpatterns += format_suffix_patterns([

    url(r'^grapherEntity/$',
        grapherEntityView.as_view(),
        name='grapherEntity_list'),

])

Пример #43
0
from django.urls import path
from viewsets_routers.views import SnippetViewSet, UserViewSet, api_root
from rest_framework import renderers
from rest_framework.urlpatterns import format_suffix_patterns

snippet_list = SnippetViewSet.as_view({"get": "list", "post": "create"})
snippet_detail = SnippetViewSet.as_view({
    "get": "retrieve",
    "put": "update",
    "patch": "partial_update",
    "delete": "destroy"
})
snippet_highlight = SnippetViewSet.as_view(
    {"get": "highlight"}, renderer_classes=[renderers.StaticHTMLRenderer])
user_list = UserViewSet.as_view({"get": "list"})
user_detail = UserViewSet.as_view({"get": "retrieve"})

urlpatterns = format_suffix_patterns([
    path("", api_root),
    path("snippets/", snippet_list, name="snippet-list"),
    path("snippets/<int:pk>/", snippet_detail, name="snippet-detail"),
    path("snippets/<int:pk>/highlight/",
         snippet_highlight,
         name="snippet-highlight"),
    path("users/", user_list, name="user-list"),
    path("users/<int:pk>/", user_detail, name="user-detail"),
])
Пример #44
0
from django.urls import include, path
from rest_framework.urlpatterns import format_suffix_patterns

from . import views

urlpatterns = format_suffix_patterns([
    path('', views.api_root),
    path('rest-auth/', include('rest_auth.urls')),
    path('rest-auth/registration/', include('rest_auth.registration.urls')),
    path('users/', include('users.urls')),
    path('friendcircle/', include('friendcircle.urls')),
    path('interests/', include('interests.urls')),
    path('prikmuur/', include('prikmuur.urls')),
])
Пример #45
0
from django.urls import path,include
from rest_framework.urlpatterns import format_suffix_patterns
from post import views

urlpatterns =format_suffix_patterns( [

    path('user/post',views.user_post_view),#posting a user post
    path('user/<int:pk>',views.user_post_detail),#geeting a specific user post
    path('club/post',views.club_post_view),#posting a club
    path('club/<int:pk>',views.club_post_detail),#getting  specific club post

    path('userspecific/<int:user_id>',views.UserSpecificPost),
    path('clubspecific/<int:club_id>',views.ClubSpecificPost),
    path('user/student/all',views.UserStudentPost),#post for all students
    path('user/prof/all',views.UserProfPost),#post for all professors
    path('club/student/all',views.ClubStudentPost),
    path('club/prof/all',views.ClubProfPost),
    path('user/student/<int:dept_id>',views.DeptSpecificStudentUserPost),#dept specific post
    path('club/student/<int:dept_id>',views.DeptSpecificStudentClubPost),#dept specific post
    path('user/prof/<int:dept_id>',views.DeptSpecificProfUserPost),#dept specific post
    path('club/prof/<int:dept_id>',views.DeptSpecificProfClubPost),#dept specific post
    # path('club/student/<int:dept_id>/<int:club_id'),
    # path('club/prof/<int:dept_id>/<int:club_id')

])
Пример #46
0
urlpatterns += format_suffix_patterns([
    url(r'^api/$', api_root),
    url(r'^api/devices/$', DeviceApiList.as_view(), name='device-api-list'),
    url(r'^api/devices/create/$',
        DeviceApiCreate.as_view(),
        name='device-api-create'),
    url(r'^api/devices/(?P<pk>\d+)/$',
        DeviceApiDetail.as_view(),
        name='device-api-detail'),
    url(r'^api/devices/(?P<pk>\d+)/bookmark/$',
        DeviceApiBookmark.as_view(),
        name='device-api-bookmark'),
    url(r'^api/devices/(?P<pk>\d+)/changeroom/$',
        DeviceApiRoomChange.as_view(),
        name='device-api-room'),
    url(r'^api/devices/(?P<pk>\d+)/pictures/$',
        DeviceApiListPictures.as_view(),
        name='device-api-pictures'),
    url(r'^api/devices/(?P<device>\d+)/pictures/(?P<pk>\d+)$',
        DeviceApiPicture.as_view(),
        name='device-api-picture'),
    url(r'^api/devices/(?P<device>\d+)/pictures/(?P<pk>\d+)/rotate/(?P<orientation>[a-z]*)$',
        DeviceApiPictureRotate.as_view(),
        name='device-api-picture-rotate'),
    url(r'^api/devices/lend/$',
        DeviceApiLend.as_view(),
        name='device-api-lend'),
    url(r'^api/devices/return/$',
        DeviceApiReturn.as_view(),
        name='device-api-return'),
    url(r'^api/smalldevices/$',
        SmallDeviceApiList.as_view(),
        name='smalldevice-api-lend'),
    url(r'^api/smalldevices/(?P<subpart>[^/]*)/$',
        SmallDeviceApiList.as_view(),
        name='smalldevice-api-lend'),
    url(r'^api/manufacturers/$',
        ManufacturerApiList.as_view(),
        name='manufacturer-api-list'),
    url(r'^api/manufacturers/create/$',
        ManufacturerApiCreate.as_view(),
        name='manufacturer-api-create'),
    url(r'^api/manufacturers/(?P<pk>\d+)/$',
        ManufacturerApiDetail.as_view(),
        name='manufacturer-api-detail'),
    url(r'^api/rooms/$', RoomApiList.as_view(), name='room-api-list'),
    url(r'^api/rooms/create/$',
        RoomApiCreate.as_view(),
        name='room-api-create'),
    url(r'^api/rooms/(?P<pk>\d+)/$',
        RoomApiDetail.as_view(),
        name='room-api-detail'),
    url(r'^api/types/$', TypeApiList.as_view(), name='type-api-list'),
    url(r'^api/types/create/$',
        TypeApiCreate.as_view(),
        name='type-api-create'),
    url(r'^api/types/(?P<pk>\d+)/$',
        TypeApiDetail.as_view(),
        name='type-api-detail'),
    url(r'^api/buildings/$',
        BuildingApiList.as_view(),
        name='building-api-list'),
    url(r'^api/buildings/create/$',
        BuildingApiCreate.as_view(),
        name='building-api-create'),
    url(r'^api/buildings/(?P<pk>\d+)/$',
        BuildingApiDetail.as_view(),
        name='building-api-detail'),
    url(r'^api/templates/$',
        TemplateApiList.as_view(),
        name='template-api-list'),
    url(r'^api/templates/create/$',
        TemplateApiCreate.as_view(),
        name='template-api-create'),
    url(r'^api/templates/(?P<pk>\d+)/$',
        TemplateApiDetail.as_view(),
        name='template-api-detail'),
    url(r'^api/ipaddresses/$',
        IpAddressApiList.as_view(),
        name='ipaddress-api-list'),
    url(r'^api/ipaddresses/create/$',
        IpAddressApiCreate.as_view(),
        name='ipaddress-api-create'),
    url(r'^api/ipaddresses/(?P<pk>\d+)/$',
        IpAddressApiDetail.as_view(),
        name='ipaddress-api-detail'),
    url(r'^api/users/$', UserApiList.as_view(), name='user-api-list'),
    url(r'^api/users/(?P<pk>\d+)/$',
        UserApiDetail.as_view(),
        name='user-api-detail'),
    url(r'^api/users/profile/$$',
        UserApiProfile.as_view(),
        name='user-api-profile'),
    url(r'^api/useravatar/(?P<username>[^/]*)/$',
        UserApiAvatar.as_view(),
        name='user-api-avatar'),
    url(r'^api/groups/$', GroupApiList.as_view(), name='group-api-list'),
    url(r'^api/groups/(?P<pk>\d+)/$',
        GroupApiDetail.as_view(),
        name='group-api-detail'),
    url(r'^api/auth/',
        include('rest_framework.urls', namespace='rest_framework')),
],
                                      allowed=["json", "html"])
Пример #47
0
    url(r'^job_data/(?P<job_id>[0-9]+)/$',
        views_api.JobData.as_view(),
        name='api-job-data'),

    url(r'^view_jobs/$',
        views_api.ViewJobsList.as_view(),
        name='api-view-jobs'),

    url(r'^view_jobs/(?P<pk>[0-9]+)/$',
        views_api.ViewJobsListDetail.as_view(),
        name='api-view-jobs-detail'),

]

api_urls = format_suffix_patterns(api_urls)

urlpatterns = patterns(
    '',
    url(r'^$',
        views.index,
        name='index'),

    url(r'^api/',
        include(api_urls,
        namespace='api')),

    url(r'^job_list/',
        include(job_list_urls,
        namespace='job_list')),
Пример #48
0
    'get': 'list',
    'post': 'create'
})

visited_location_list = VisitedLocationViewSet.as_view({
    'get': 'list',
    'post': 'create'
})

geolocation_detail = GeolocationViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
})

visited_location_detail = VisitedLocationViewSet.as_view({
    'get': 'retrieve',
    'put': 'update',
    'patch': 'partial_update',
    'delete': 'destroy'
})

urlpatterns = format_suffix_patterns([
    path('', api_root),
    path('geolocations/', geolocation_list, name="geolocation-list"),
    path('visited_locations/',
         visited_location_list,
         name="visited_location-list"),
])
Пример #49
0
from rest_framework.urlpatterns import format_suffix_patterns
from django.conf.urls import patterns,url,include
import views
import rests
urlpatterns = format_suffix_patterns(patterns('hdfs.views',
    url('^state/$', rests.HostState.as_view(), name='HostState-list' ),
    url('^relation/(?P<host_name>.+)/$', rests.Relation.as_view(), name='relation-info'),
    url('^operator/$', rests.OperateService.as_view(), name='operate'),
    url(r'^(?P<host_name>[\w|\-.\d-]+)/(?P<component_name>[A-Z]+)/(?P<operate>[A-Z]+)/$', rests.OperateComponent.as_view(),name="operate-component"),
    url(r'^capacity/(?P<space_name>.*)/$',rests.capacityRecovery.as_view()),
    url(r'^share/(?P<path>.*)/$',rests.share.as_view()),
    url(r'^upload/(?P<path>.*)/$',rests.upload),
    url(r'^(?P<path>.*)/$',rests.pathOp.as_view()),
 ))


Пример #50
0
from rest_framework.urlpatterns import format_suffix_patterns
from .views import *
from django.urls import path, include

login = Login.as_view({'post': 'login'})
logout = Logout.as_view({'get': 'logout'})

urlpatterns = format_suffix_patterns([
    path('o/', include('oauth2_provider.urls'), name="oauth2"),
    path('login', login, name='login'),
    path('logout', logout, name='logout'),
])
Пример #51
0
from django.conf.urls import url, include
from rest_framework.urlpatterns import format_suffix_patterns
from server.api.v1.views import api_index, get_query_result, get_autocomplete
import server.api.v1.commands.commands as commands


urlpatterns = [

    url(r'^$', api_index, name='api_v1'),
    url(r'get_query_result', get_query_result, name="get_query_result"),
    url(r'^lines', commands.lines, name="lines"),
    url(r'^get_autocomplete', get_autocomplete, name="autocomplete"),
]

urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'api'])
Пример #52
0
from django.conf.urls import url
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns

from backend import views
from backend.exceptions import handle_not_found

urlpatterns = format_suffix_patterns([
    path('s/shorten', views.shorten),
    path('s/<str:key>', views.go_to),
    url(r'.*', handle_not_found)
])
# pylint: disable=invalid-name
from django.conf.urls import url
from rest_framework.urlpatterns import format_suffix_patterns

from . import views_api as views

app_name = 'facebook_api'
urlpatterns_raw = (
    url(r'^facebook/$', views.FacebookPageAPIList.as_view(), name='list'),
    url(r'^facebook/(?P<pk>[0-9]+)/$', views.FacebookPageAPIDetail.as_view(), name='detail'),
    url(r'^facebook/new/$', views.send_form, name='send_form'),
)
urlpatterns = format_suffix_patterns(urlpatterns_raw, allowed=['json'])
Пример #54
0
    'delete': 'destroy'
})
snippet_highlight = SnippetViewSet.as_view({
    'get': 'highlight'
}, renderer_classes=[renderers.StaticHTMLRenderer])
user_list = UserViewSet.as_view({
    'get': 'list'
})
user_detail = UserViewSet.as_view({
    'get': 'retrieve'
})

urlpatterns = format_suffix_patterns([
    url(r'^$', api_root),
    url(r'^snippets/$', snippet_list, name='snippet-list'),
    url(r'^snippets/(?P<pk>[0-9]+)/$', snippet_detail, name='snippet-detail'),
    url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', snippet_highlight, name='snippet-highlight'),
    url(r'^users/$', user_list, name='user-list'),
    url(r'^users/(?P<pk>[0-9]+)/$', user_detail, name='user-detail')
]) + [url(r'^admin/', admin.site.urls)]

# urlpatterns = [
# 	url(r'^$', views.api_root),
# 	url(r'^snippets/$', views.SnippetList.as_view(), name='snippet-list'),
# 	url(r'^snippets/(?P<pk>[0-9]+)/$', views.SnippetDetail.as_view(), name='snippet-detail'),
# 	url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', views.SnippetHighlight.as_view(), name='snippet-highlight'),
# 	url(r'^users/$', views.UserList.as_view(), name='user-list'),
#     url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view(), name='user-detail'),
# ]

# urlpatterns = format_suffix_patterns([
#     url(r'^$', views.api_root),
Пример #55
0
        name='taxon-detail'),

    # url(r'^accounts/login/$',
    #     'radiograph.views.login',
    #     {'template_name': 'radiograph/login.html'},
    #     name='login'),

    # url(r'^accounts/logout/$',
    #     'radiograph.views.logout',
    #     {'next_page': '/'},
    #     name='logout'),

    # API root
    url(r'', 'api_root', name='root'),
)
api_patterns = format_suffix_patterns(api_patterns)

urlpatterns = patterns('',
    url(r'^api/', include(api_patterns, namespace='api')),

    # Primary views
    url(r'^$', 'radiograph.views.index', name='index'),
    url(r'^specimens$', 'radiograph.views.specimens', name='specimen-list'),
    url(r'^specimens/(?P<specimen_id>[0-9]+)$',
        'radiograph.views.specimen',
        name='specimen-detail'),
    url(r'^specimens/download-zip$', 'radiograph.views.download_zip', name='specimen-download-zip'),
    url(r'^images/(?P<image_id>[0-9]+)/(?P<derivative>[^/]+)$',
        'radiograph.views.image_file',
        name='image'),
    url(r'^download$', 'radiograph.views.download', name='download-dataset'),
Пример #56
0
"""blog_app URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/1.9/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  url(r'^$', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  url(r'^$', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.conf.urls import url, include
    2. Add a URL to urlpatterns:  url(r'^blog/', include('blog.urls'))
"""
from django.conf.urls import url, include
from django.contrib import admin
from django.conf import settings
from django.conf.urls.static import static
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^', include('app.urls'))
]

urlpatterns += static(settings.STATIC_URL, document_root=settings.STATIC_ROOT)
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
urlpatterns = format_suffix_patterns(urlpatterns, allowed=['json', 'html'])
Пример #57
0
from snippets import views
from django.conf.urls import patterns, url, include
from rest_framework.urlpatterns import format_suffix_patterns

urlpatterns = format_suffix_patterns(patterns('snippets.views',
    url(r'^$', 'api_root'),
    url(r'^snippets/$', views.SnippetList.as_view(), name='snippet-list'),
    url(r'^snippets/(?P<pk>[0-9]+)/$', views.SnippetDetail.as_view(), name='snippet-detail'),
    url(r'^snippets/(?P<pk>[0-9]+)/highlight/$', views.SnippetHighlight.as_view(), name='snippet-highlight'),
    url(r'^users/$', views.UserList.as_view(), name='user-list'),
    url(r'^users/(?P<pk>[0-9]+)/$', views.UserDetail.as_view(), name='user-detail')
))

urlpatterns += patterns('',
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
)
Пример #58
0
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns

from .views import PinCommentViewSet, PinIssueViewSet

app_name = 'catfood.apps.issues'

pin_issue_list = PinIssueViewSet.as_view({'get': 'list', 'post': 'create'})
pin_issue_detail = PinIssueViewSet.as_view({'delete': 'destroy'})
pin_comment_list = PinCommentViewSet.as_view({'get': 'list', 'post': 'create'})
pin_comment_detail = PinCommentViewSet.as_view({'delete': 'destroy'})

urlpatterns = format_suffix_patterns(
    [
        path('pins/', pin_issue_list, name='pin-issue-list'),
        path('pins/<int:pk>/', pin_issue_detail, name='pin-issue-detail'),
        path('<int:issue_id>/comments/', pin_comment_list, name='pin-comment-list'),
        path(
            '<int:issue_id>/comments/<int:pk>/',
            pin_comment_detail,
            name='pin-comment-detail',
        ),
    ]
)
Пример #59
0
"""API urls defined for views."""

from django.conf.urls import url

from rest_framework.urlpatterns import format_suffix_patterns

from api import views


urlpatterns = [
    url(r"^menu/$", views.MenuList.as_view(), name="menulist"),
    url(r"^rating/all/$", views.RatingList.as_view(), name="ratinglist"),
    url(r"^rating/week/$", views.WeeklyRatings.as_view(), name="weeklyratinglist"),
]


urlpatterns = format_suffix_patterns(urlpatterns, allowed=["json", "html"])
Пример #60
0
from django.urls import path
from rest_framework.urlpatterns import format_suffix_patterns
from .views import *

urlpatterns = [
    path('', HistoryList.as_view(), name='history-list'),
    path('create/<int:game>', HistoryCreate.as_view(), name='history-create'),
    path('<slug:slug>/', HistoryDetail.as_view(), name='history-detail'),
]

urlpatterns = format_suffix_patterns(urlpatterns)