Beispiel #1
0
    def test_flatten_url_tree_url_import_with_routers(self):

        class MockApiViewSet(ModelViewSet):
            serializer_class = CommentSerializer
            model = User

        class AnotherMockApiViewSet(ModelViewSet):
            serializer_class = CommentSerializer
            model = User

        router = DefaultRouter()
        router.register(r'other_views', MockApiViewSet)
        router.register(r'more_views', MockApiViewSet)

        urls_app = patterns('', url(r'^', include(router.urls)))
        urls = patterns(
            '',
            url(r'api/', include(urls_app)),
            url(r'test/', include(urls_app))
        )
        urlparser = UrlParser()
        apis = urlparser.get_apis(urls)

        self.assertEqual(sum(api['path'].find('api') != -1 for api in apis), 4)
        self.assertEqual(sum(api['path'].find('test') != -1 for api in apis), 4)
Beispiel #2
0
class Restify(object):

    def __init__(self):
        # get restify specific settings
        self.settings = getattr(settings, 'RESTIFY', {})

        self.IGNORE_LIST = ['^django*', '^api$', '^rest_framework*',
                            '^auth*'] + self.settings.get('IGNORE_LIST', [])
        self.router = None
        self.viewsets = {}   # viewsets
        self.apps()

    def slugify(self, value):
        try:
            value = unicodedata.normalize('NFKD', value).encode(
                'ascii', 'ignore').decode('ascii')
        except:
            pass
        value = re.sub('[^\w\s-]', '', value).strip().lower()

        return re.sub('[-\s]+', '-', value)

    def get_apps(self):
        return apps.app_configs

    def apps(self):
        all_apps = self.get_apps()
        MODELS = self.settings.get('MODELS', None)

        for app, app_config in all_apps.items():
            # Check if user is in ignored list
            found = [ignore_pattern for ignore_pattern in self.IGNORE_LIST
                     if re.findall(ignore_pattern, app_config.name)]
            if found:
                continue

            for model in app_config.get_models():
                if MODELS and model._meta.model_name not in MODELS:
                    continue

                url = self.slugify(model._meta.verbose_name_plural.title())
                view = Views()
                viewset = view.get_viewsets(model)

                self.viewsets[url] = viewset

    def register(self):
        self.router = DefaultRouter()
        for url, viewset in self.viewsets.items():
            self.router.register(url, viewset)

        # special case fo User model
        user_viewset = get_user_viewset()
        self.router.register('users', user_viewset)

        return self.router

    def router(self):
        return self.router
 def setUp(self):
     router = DefaultRouter()
     router.register('example1', Http404ExampleViewSet, base_name='example1')
     router.register('example2', PermissionDeniedExampleViewSet, base_name='example2')
     self.patterns = [
         url('^example/?$', ExampleListView.as_view()),
         url(r'^', include(router.urls))
     ]
class TestNameableRoot(TestCase):
    def setUp(self):
        class NoteViewSet(viewsets.ModelViewSet):
            model = RouterTestModel
        self.router = DefaultRouter()
        self.router.root_view_name = 'nameable-root'
        self.router.register(r'notes', NoteViewSet)
        self.urls = self.router.urls

    def test_router_has_custom_name(self):
        expected = 'nameable-root'
        self.assertEqual(expected, self.urls[0].name)
class TestRootWithAListlessViewset(TestCase):
    def setUp(self):
        class NoteViewSet(mixins.RetrieveModelMixin, viewsets.GenericViewSet):
            model = RouterTestModel

        self.router = DefaultRouter()
        self.router.register(r"notes", NoteViewSet)
        self.view = self.router.urls[0].callback

    def test_api_root(self):
        request = factory.get("/")
        response = self.view(request)
        self.assertEqual(response.data, {})
class TestNameableRoot(TestCase):
    def setUp(self):
        class NoteViewSet(viewsets.ModelViewSet):
            queryset = RouterTestModel.objects.all()

        self.router = DefaultRouter()
        self.router.root_view_name = 'nameable-root'
        self.router.register(r'notes', NoteViewSet)
        self.urls = self.router.urls

    def test_router_has_custom_name(self):
        expected = 'nameable-root'
        assert expected == self.urls[-1].name
Beispiel #7
0
    def test_exclude_router_api_root(self):
        class MyViewSet(ModelViewSet):
            serializer_class = CommentSerializer
            model = User

        router = DefaultRouter()
        router.register('test', MyViewSet)

        urls_created = len(router.urls)

        parser = UrlParser()
        apis = parser.get_apis(router.urls)

        self.assertEqual(4, urls_created - len(apis))
Beispiel #8
0
class GeoModelViewSetTestCase(SimpleQueryTestCase):
    def setUp(self):
        self.router = DefaultRouter()
        self.router.register(r'locations', LocationViewSet)
        self.view = LocationViewSet.as_view({'get': 'list'})

    def test_renderer(self):
        request = factory.get('/locations/',
                              HTTP_ACCEPT=GeoJSONRenderer.media_type)
        response = self.view(request)
        self.assertIsInstance(response.accepted_renderer, GeoJSONRenderer)

    def test_register(self):
        self.assertGreater(len(self.router.urls), 0)
class RasterViewSetTestCase(SimpleTestCase):
    def setUp(self):
        self.router = DefaultRouter()
        self.router.register(r'rasters', RasterViewSet)
        self.view = RasterViewSet.as_view({'get': 'list'})

    def test_renderer(self):
        request = factory.get('/rasters/',
                              HTTP_ACCEPT=GeoTIFFZipRenderer.media_type)
        response = self.view(request)
        self.assertEqual(response['Content-Type'],
                         GeoTIFFZipRenderer.media_type)

    def test_register(self):
        self.assertGreater(len(self.router.urls), 0)
Beispiel #10
0
    def test_flatten_url_tree_url_import_with_routers(self):
        class MockApiViewSet(ModelViewSet):
            serializer_class = CommentSerializer
            model = User

        class AnotherMockApiViewSet(ModelViewSet):
            serializer_class = CommentSerializer
            model = User

        router = DefaultRouter()
        router.register(r"other_views", MockApiViewSet)
        router.register(r"more_views", MockApiViewSet)

        urls_app = patterns("", url(r"^", include(router.urls)))
        urls = patterns("", url(r"api/", include(urls_app)), url(r"test/", include(urls_app)))
        urlparser = UrlParser()
        apis = urlparser.get_apis(urls)

        self.assertEqual(sum(api["path"].find("api") != -1 for api in apis), 4)
        self.assertEqual(sum(api["path"].find("test") != -1 for api in apis), 4)
Beispiel #11
0
def get_router():
    """
    Get a Django REST Framework router instance with all viewsets.

    :rtype: rest_framework.routers.DefaultRouter
    """
    router = DefaultRouter()
    router.register(r'projects', ProjectViewSet)
    router.register(r'issues', IssueViewSet)
    router.register(r'comments', CommentViewSet)
    return router
Beispiel #12
0
from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from mailadmin.views import MyUserViewSet, MyOrgUnitViewSet, OrgUnitViewSet, AliasesView, get_domain, index, lists

urlpatterns = [
    url(r'^$', index, name='index'),
    url(r'^lists/', lists, name='lists'),
]

# API
router = DefaultRouter()
router.register(r'api/me', MyUserViewSet, base_name='me')
router.register(r'api/orgunits', MyOrgUnitViewSet, base_name='ous')
router.register(r'api/orgunits/all', OrgUnitViewSet, base_name='allous')
urlpatterns += router.urls

urlpatterns += [
    url(r'^api/aliases/', AliasesView.as_view(), name='aliases'),
    url(r'^api/emaildomain/', get_domain, name='email-domain'),
]
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include,re_path
from django.conf.urls import url, include
from django.conf import settings
from django.views.static import serve
from files.urls import router as file_router
from rest_framework.routers import DefaultRouter
from files.views import TempFileViewSet

router = DefaultRouter()
router.register('tempfile', TempFileViewSet, basename='tempfile')

urlpatterns = [
    path('admin/', admin.site.urls),
    url(r'^api/', include(file_router.urls)),
    re_path('media/(?P<path>.*)', serve, {'document_root': settings.MEDIA_ROOT}),
]
Beispiel #14
0
from django.conf.urls import url, include

from rest_framework.routers import DefaultRouter

from vacation_app.views import *
from vacation_app.views import authorization


router = DefaultRouter()
router.register(r'users', EmployeeViewSet)
router.register(r'vacations', VacationViewSet)
router.register(r'mails', DeliveryViewSet)

urlpatterns = [
    url(r'^', include(router.urls)),
    url(r'^api-token-auth/', authorization.TokenAuthWithIdNameGroup.as_view()),
    url(r'^i18n/', include('django.conf.urls.i18n'))
]
Beispiel #15
0
from tunga_projects.views import ProjectViewSet, DocumentViewSet, ParticipationViewSet, ProgressEventViewSet, \
    ProgressReportViewSet, InterestPollViewSet
from tunga_settings.views import UserSettingsView
from tunga_support.views import SupportPageViewSet, SupportSectionViewSet
from tunga_tasks.views import TimeEntryViewSet, \
    coinbase_notification, bitpesa_notification, EstimateViewSet, QuoteViewSet, MultiTaskPaymentKeyViewSet, \
    TaskPaymentViewSet, ParticipantPaymentViewSet, SkillsApprovalViewSet, SprintViewSet, TaskDocumentViewSet, TaskViewSet
from tunga_uploads.views import UploadViewSet
from tunga_utils.views import SkillViewSet, ContactRequestView, get_medium_posts, get_oembed_details, upload_file, \
    find_by_legacy_id, InviteRequestView, weekly_report, hubspot_notification, calendly_notification, search_logger

api_schema_view = get_swagger_view(title='Tunga API')

router = DefaultRouter()
# v3 routes
router.register(r'users', UserViewSet)
router.register(r'apply', DeveloperApplicationViewSet)
router.register(r'invite', DeveloperInvitationViewSet)
router.register(r'me/education', EducationViewSet)
router.register(r'me/work', WorkViewSet)
router.register(r'projects', ProjectViewSet)
router.register(r'documents', DocumentViewSet)
router.register(r'participation', ParticipationViewSet)
router.register(r'interest-polls', InterestPollViewSet)
router.register(r'progress-events', ProgressEventViewSet)
router.register(r'progress-reports', ProgressReportViewSet)
router.register(r'invoices', InvoiceViewSet)
router.register(r'payments', PaymentViewSet)
router.register(r'activity', ActionViewSet)
router.register(r'comments', CommentViewSet)
router.register(r'channels', ChannelViewSet)
Beispiel #16
0
from django.urls import path, include
from .views import *
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register("skill-set", SkillSetView)

urlpatterns = [
    path('', include(router.urls)),
    path('setting', SettingView.as_view()),
    path('login', UserLogin.as_view(), name="User_Login"),
    path('register', Register.as_view(), name="User_Register")
]
Beispiel #17
0
from django.conf.urls import patterns, include, url

from django.contrib import admin
admin.autodiscover()

from rest_framework.routers import DefaultRouter

from .views import *

router = DefaultRouter()
router.register(r'measurement', MeasurementViewSet)
router.register(r'sequence',    SequenceViewSet)
router.register(r'parameter',   ParameterViewSet)
#router.register(r'measurement_bulk', MeasurementListView)

urlpatterns = (
    url(r'api/v1.0/', include(router.urls)),
    url(r'api/v1.0/measurement_bulk/', MeasurementListView.as_view()),
    url(r'api/v1.0/measurement_by_time', MeasurementListByTimeView.as_view()),
    # url
)
Beispiel #18
0
from django.urls import path
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns
from . import views


router = DefaultRouter()

router.register(r'', views.LikeViewSet, basename="likes")


# urlpatterns = [
#     path('', views.LikeList.as_view()),
#     path('<int:pk>/', views.LikeDetail.as_view())
# ]
urlpatterns = router.urls
Beispiel #19
0
from django.urls import path, include 
from .views import AdoptionViewSet # This library gives us all of the functions usually found in views.py
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(r'', AdoptionViewSet, basename='adoption')
urlpatterns = router.urls
Beispiel #20
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter

from .views import ProductViewSet, CategoriesList, CommentCreate

router = DefaultRouter()
router.register('', ProductViewSet)

# products = ProductViewSet.as_view({
#     'get': 'list',
#     'put': 'update',
#     'patch': 'partial_update',
#     'post': 'create',
#     'delete': 'destroy'
# })

urlpatterns = [
    # path('', ProductsList.as_view()),
    # path('detail/<str:pk>/', ProductDetail.as_view()),
    path('categories/', CategoriesList.as_view()),

    # path('', products),
    # path('<str:pk>/', products),

    # path('create/', CreateProduct.as_view()),
    # path('update/<str:pk>/', UpdateProduct.as_view()),
    # path('delete/<str:pk>/', DeleteProduct.as_view()),
    path('', include(router.urls)),
    path('comment/create/', CommentCreate.as_view()),
]
Beispiel #21
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register('register', views.RegistrationAPI, base_name='register')
# router.register('login', views.LoginView, base_name='login')

urlpatterns = [
    path('', include(router.urls)),
    path('login/', views.login, name='login'),
    path('logout/', views.Logout, name='logout'),
]
Beispiel #22
0
from django.contrib import admin
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from . import views

router = DefaultRouter()
router.register('schedule', views.PostViewSet)
router.register('album', views.ImgViewSet)
router.register('file', views.FileViewSet)

urlpatterns = [
    path('', include(router.urls)),
]

from django.conf.urls import patterns, url, include
from api import views
from rest_framework.routers import DefaultRouter

# Create a router and register our viewsets with it.
router = DefaultRouter()
#router.register(r'packages', views.PackagesViewSet)
#router.register(r'package_versions', views.PackageVersionsViewSet)
#router.register(r'package_version_dependencies', views.PackageVersionDependenciesViewSet)
router.register(r'installations', views.InstallationViewSet)
router.register(r'version-content', views.PackageVersionContentViewSet)

# The API URLs are now determined automatically by the router.
# Additionally, we include the login URLs for the browseable API.
urlpatterns = patterns('',
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
)
Beispiel #24
0
from django.conf.urls import url
from rest_framework.routers import DefaultRouter
from .views import PhotographerViewSet, PhotoViewSet, EquipmentViewSet, PhotoViewSet, AvailTimeViewSet, \
    StyleViewSet, CustomerViewSet, JobsViewSet, JobReservationViewSet, UserViewSet, ProfileViewSet, \
    NotificationViewSet, PhotographerSearchViewSet, ChangePasswordViewSet, ReviewViewSet, PaymentViewSet,\
    RegisterViewSet, GetjobsViewSet, GetPaymentToCustomerViewSet, GetPaymentToPhotographerViewSet, GetFavPhotographersViewSet

router = DefaultRouter()
router.register(r'photographers',
                PhotographerViewSet,
                basename='photographers')
router.register(r'photographersearch',
                PhotographerSearchViewSet,
                basename='photographersearch')
router.register(r'payment', PaymentViewSet, basename='payment')
router.register(r'getpayment-photographer',
                GetPaymentToPhotographerViewSet,
                basename='getphotographerpayment')
router.register(r'getpayment-customer',
                GetPaymentToCustomerViewSet,
                basename='getpayment-customer')
# router.register(r'customers', CustomerViewSet, basename='customer')
router.register(r'customers', CustomerViewSet, basename='customers')
router.register(r'getfavphotographers',
                GetFavPhotographersViewSet,
                basename='getfavphotographers')
router.register(r'jobs', JobsViewSet, basename='jobs')
router.register(r'getjobs', GetjobsViewSet, basename='getjobs')
router.register(r'reservation', JobReservationViewSet, basename='reservation')
router.register(r'review', ReviewViewSet, basename='review')
router.register(r'users', UserViewSet, basename='users')
Beispiel #25
0
from rest_framework.routers import DefaultRouter

from . import views

router = DefaultRouter()
router.register(r'jobs', views.JobViewSet)
from django.conf.urls import url
from django.urls import include, path
#from usuarios.views import CerrarSesionView,LoginView
from usuarios.api.views import AuthViewSet

from rest_framework.routers import DefaultRouter
from rest_framework_jwt.views import obtain_jwt_token
router = DefaultRouter()
app_name = 'usuarios_api'

router.register(r'auth', AuthViewSet, base_name='auth')

urlpatterns = [
    url(r'^rest-auth/', include('rest_auth.urls')),
    url(r'^rest-auth/registration/', include('rest_auth.registration.urls')),
    url(r'^api-token-auth/', obtain_jwt_token),
    #url(r'^auth/', AuthViewSet.as_view() , name='auth'),
    #url(r'^login/$', LoginView.as_view(), name='login'),
    #url(r'^cerrar-sesion/$', CerrarSesionView.as_view(), name='cerrar-sesion'),
    #url(r'^rest-auth/', include('rest_auth.urls')),
]

urlpatterns += router.urls
Beispiel #27
0
from django.conf import settings
from django.conf.urls import include, url

from rest_framework.routers import DefaultRouter

from .views import DiscretizedDataPointViewSet


router = DefaultRouter()
router.register(r'discretized_data_points', DiscretizedDataPointViewSet)

urlpatterns = [
    url(r'^api/' + settings.API_VERSION + '/', include(router.urls)),  # TODO makes sense to have a settings.API_BASE_URL rather than a settings.API_VERSION?
]
Beispiel #28
0
from django.conf.urls import url,include
from rest_framework.routers import DefaultRouter
from SessionApp.views import StudentView
router=DefaultRouter()
router.register('students',StudentView,base_name='students')

urlpatterns=[
    url(r'',include(router.urls))
]
    @action(detail=True, url_path='detail/(?P<kwarg>[0-9]{4})')
    def regex_url_path_detail(self, request, *args, **kwargs):
        pk = self.kwargs.get('pk', '')
        kwarg = self.kwargs.get('kwarg', '')
        return Response({'pk': pk, 'kwarg': kwarg})


notes_router = SimpleRouter()
notes_router.register(r'notes', NoteViewSet)

kwarged_notes_router = SimpleRouter()
kwarged_notes_router.register(r'notes', KWargedNoteViewSet)

namespaced_router = DefaultRouter()
namespaced_router.register(r'example', MockViewSet, basename='example')

empty_prefix_router = SimpleRouter()
empty_prefix_router.register(r'', EmptyPrefixViewSet, basename='empty_prefix')

regex_url_path_router = SimpleRouter()
regex_url_path_router.register(r'', RegexUrlPathViewSet, basename='regex')


class BasicViewSet(viewsets.ViewSet):
    def list(self, request, *args, **kwargs):
        return Response({'method': 'list'})

    @action(methods=['post'], detail=True)
    def action1(self, request, *args, **kwargs):
        return Response({'method': 'action1'})
Beispiel #30
0
    http://www.django-rest-framework.org/tutorial/6-viewsets-and-routers/

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

from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns

from stock import views

#Create a router
router = DefaultRouter()

#Register the viewset
router.register(r'stock', views.StockViewSet)

#TODO: Maybe create a new app "Portfolio" for this resume?
urlpatterns = [
    url(r'^stock/resume/$', views.OwnedStocksAPIView.as_view(), name="resume"),
    url(r'^stock/user_resume/$', views.OwnedByUserStocksAPIView.as_view(), name="user_resume"),
    url(r'^stock/updated_stock/(?P<pk>[^/.]+)/$', views.StockApiView.as_view(), name="updated_stock")
]

urlpatterns = format_suffix_patterns(urlpatterns)

urlpatterns += [
    url(r'^', include(router.urls)),
]
Beispiel #31
0
from django.conf.urls import patterns, url, include
from django.conf import settings

from filmy import settings
from filmy_app import views

from rest_framework.routers import DefaultRouter

# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()


# Create a router and register our viewsets with it.
router = DefaultRouter(trailing_slash=False)
router.register(r'video', views.VideoViewSet)
router.register(r'user', views.UserViewSet)
router.register(r'person', views.PersonViewSet)
router.register(r'category', views.CategoryViewSet)
router.register(r'audioinfo', views.AudioInfoViewSet)
router.register(r'videoinfo', views.VideoInfoViewSet)
router.register(r'storage', views.StorageViewSet)
router.register(r'storage_line', views.StorageLineViewSet)
router.register(r'device', views.DeviceViewSet)
router.register(r'country', views.CountryViewSet)
router.register(r'language', views.LanguageViewSet)


# The API URLs are now determined automatically by the router.
# Additionally, we include the login URLs for the browseable API.
urlpatterns = patterns('',
Beispiel #32
0
from django.urls import path

from profiles_api import views

from django.urls import path, include

from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register('hello-viewset', views.HelloViewSet, base_name='hello-viewset')
router.register('profile', views.UserProfileViewSet)
router.register('Feed', views.UserProfileFeedViewSet)
urlpatterns = [
    path('hello-view/', views.HelloApiView.as_view()),
    path('login/', views.UserLoginApiView.as_view()),
    path('', include(router.urls)),
]
Beispiel #33
0
from django.urls import path, include

from rest_framework.routers import DefaultRouter

from anime_list import views

router = DefaultRouter()
router.register("anime", views.AnimeViewSet)
router.register("season", views.AnimeSeasonViewSet)
router.register("genre", views.GenreViewSet)

urlpatterns = [
    path("", include(router.urls)),
]
Beispiel #34
0
from applications.views import ApplicationViewSet
from rest_framework.routers import DefaultRouter


app_name = 'application'

router = DefaultRouter()
router.register(r'applications', ApplicationViewSet, basename='application')
urlpatterns = router.urls
Beispiel #35
0
from django.conf import settings
from rest_framework.routers import DefaultRouter, SimpleRouter

from shokrnet.ip_manager.viewsets import LocationViewSet, DeviceTypeViewSet, DeviceViewSet, SubnetViewSet, IPViewSet, \
    VLANViewSet, ServiceViewSet
from shokrnet.users.api.views import UserViewSet

if settings.DEBUG:
    router = DefaultRouter()
else:
    router = SimpleRouter()

router.register("users", UserViewSet)

router.register("locations", LocationViewSet)
router.register("device_types", DeviceTypeViewSet)
router.register("devices", DeviceViewSet)
router.register("subnets", SubnetViewSet)
router.register("ips", IPViewSet)
router.register("vlans", VLANViewSet)
router.register("services", ServiceViewSet)

app_name = "api"
urlpatterns = router.urls
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from profiles_api.views import UserProfileViewset, UserLoginApiView, ProfileFeedItemViewset


router = DefaultRouter()
router.register('profiles', UserProfileViewset)
router.register('feed', ProfileFeedItemViewset)

urlpatterns = [
    path('login/', UserLoginApiView.as_view()),
    path('', include(router.urls)),
]
Beispiel #37
0
# -*- coding: utf-8 -*-
from __future__ import print_function, unicode_literals

from rest_framework.routers import DefaultRouter

from test_project.many_to_many import api as m2m_api
from test_project.many_to_one import api as m2o_api
from test_project.one_to_one import api as o2o_api


router = DefaultRouter()

router.register('one-to-one/places/alchemy', o2o_api.SQLAlchemyPlaceViewSet, 'one-to-one-alchemy:place')
router.register('one-to-one/places', o2o_api.PlaceViewSet, 'one-to-one:place')
router.register('one-to-one/restaurants/alchemy', o2o_api.SQLAlchemyRestaurantViewSet, 'one-to-one-alchemy:restaurant')
router.register('one-to-one/restaurants', o2o_api.RestaurantViewSet, 'one-to-one:restaurant')
router.register('one-to-one/waiters/alchemy', o2o_api.SQLAlchemyWaiterViewSet, 'one-to-one-alchemy:waiter')
router.register('one-to-one/waiters', o2o_api.WaiterViewSet, 'one-to-one:waiter')

router.register('many-to-one/reporters/alchemy', m2o_api.SQLAlchemyReporterViewSet, 'many-to-one-alchemy:reporter')
router.register('many-to-one/reporters', m2o_api.ReporterViewSet, 'many-to-one:reporter')
router.register('many-to-one/articles/alchemy', m2o_api.SQLAlchemyArticleViewSet, 'many-to-one-alchemy:article')
router.register('many-to-one/articles', m2o_api.ArticleViewSet, 'many-to-one:article')

router.register('many-to-many/publications/alchemy', m2m_api.SQLAlchemyPublicationViewSet, 'many-to-many-alchemy:publication')
router.register('many-to-many/publications', m2m_api.PublicationViewSet, 'many-to-many:publication')
router.register('many-to-many/articles/alchemy', m2m_api.SQLAlchemyArticleViewSet, 'many-to-many-alchemy:article')
router.register('many-to-many/articles', m2m_api.ArticleViewSet, 'many-to-many:article')

urlpatterns = router.urls
Beispiel #38
0
from django.conf.urls import url

from rest_framework.routers import DefaultRouter

from message_board.rest.views import MessageBoardViewSet

router = DefaultRouter()
# router.register('', ReportViewSet, 'api-report')
router.register('', MessageBoardViewSet, 'api-message-board')

urlpatterns = router.urls
Beispiel #39
0
# -*- coding: utf-8 -*-
from django.conf.urls import patterns, include, url
from files.api import FilesViewSet
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register("files", FilesViewSet)

urlpatterns = patterns("", url(r"", include(router.urls)))
Beispiel #40
0
from django.urls import path
from django.conf.urls import url
from rest_framework.routers import DefaultRouter

from .apis import DeviceViewSet

router = DefaultRouter()
router.register('device', DeviceViewSet, 'device')

urlpatterns = router.urls
urlpatterns += []
Beispiel #41
0
from django.conf.urls import url, include
from rest_framework.routers import DefaultRouter

from main.api import views
router = DefaultRouter()
router.register('games', views.GameViewSet)
router.register('users', views.UserViewSet)

urlpatterns = [
    url('^index/', views.Index.as_view()),
    url('^login/', views.Login.as_view()),
    url('^logout/', views.Logout.as_view()),
    url('^check_auth/', views.CheckAuthentication.as_view()),

    url('^hi_scores/', views.GetHiScoreTop.as_view()),

    url(r'', include(router.urls)),
]
Beispiel #42
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .viewsets import VehicleViewSet, VehicleTypeViewSet

router = DefaultRouter()
router.register("vehicletype", VehicleTypeViewSet)
router.register("vehicle", VehicleViewSet)

urlpatterns = [
    path("", include(router.urls)),
]
Beispiel #43
0
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import patterns, include, url
from rest_framework.urlpatterns import format_suffix_patterns
from rest_framework.routers import DefaultRouter
from accounts.api.views import UserViewSet, ObtainAccountAuthToken
from reader.api.views import FeedViewSet, ArticleViewSet


router = DefaultRouter()
router.register(r"accounts", UserViewSet)
router.register(r"articles", ArticleViewSet)
router.register(r"feeds", FeedViewSet)


urlpatterns = patterns(
    "",
    url(r"^api-token-auth/$", ObtainAccountAuthToken.as_view()),
    url(r"^api/", include(router.urls))
    # url(r'^api/feeds/$', feedListView)
    # url(r'^user/(?P<pk>[0-9]+)/$', views.UserDetailView),
    # url(r'^api/feeds/$', views.FeedList.as_view()),
    # url(r'^api/feeds/(?P<pk>[0-9]+)/$', views.FeedDetail.as_view()),
    # url(r'^api/feeds/(?P<feed_id>[0-9]+)$', views.ArticleList.as_view())
) + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
Beispiel #44
0
from django.conf import settings
from django.conf.urls.static import static
from django.conf.urls import patterns, url
from django.conf.urls import include
from localground.apps.site.api import views
from localground.apps.site import models
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns

entities = ['audio', 'photos', 'map-images']

# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'users', views.UserViewSet)
router.register(r'groups', views.GroupViewSet)
router.register(r'data-types', views.DataTypeViewSet)
router.register(r'layouts', views.LayoutViewSet)
router.register(r'overlay-sources', views.OverlaySourceViewSet)

# The API URLs are now determined automatically by the router.
# Additionally, we include the login URLs for the browseable API.
urlpatterns = patterns(
    '',
    url(r'^$', views.api_root),
    # a hack to include both ViewSets and views on the front
    # page
    url(r'^', include(router.urls[1:])),
)

urlpatterns += format_suffix_patterns(
    patterns(
Beispiel #45
0
from django.conf.urls import url, patterns, include
from rest_framework.routers import DefaultRouter

from . import views 

router = DefaultRouter()

for viewset in views.AppViewsets:
    router.register(viewset.model.__name__.lower(), viewset)


urlpatterns = patterns('',
    url(r'^$',
        views.HomeView.as_view(),
        name='home'),
    url(r'^api/', include(router.urls)),
    url(r'^schema/$',
        views.schema_json,
        name='schema'),
                           
)
Beispiel #46
0
from pyplan.pyplan.inputtemplate.views import InputTemplateView
from pyplan.pyplan.modelmanager.views import ModelManagerView
from pyplan.pyplan.preference.views import PreferenceViewSet
from pyplan.pyplan.preference_module.views import PreferenceModuleViewSet
from pyplan.pyplan.report.views import ReportView
from pyplan.pyplan.security.views import SecurityView
from pyplan.pyplan.user_company_preference.views import \
    UserCompanyPreferenceViewSet
from pyplan.pyplan.usercompanies.views import UserCompanyViewSet
from pyplan.pyplan.users.views import UserViewSet
from pyplan.pyplan.notification.views import NotificationViewSet

router = DefaultRouter()

# Activity
router.register(r'activities', ActivityViewSet)

# Users
router.register(r'users', UserViewSet)

# Companies
router.register(r'companies', CompanyViewSet)
router.register(r'usercompanies', UserCompanyViewSet)

# Permission
router.register(r'permissions', PermissionViewSet, base_name='permissions')

# Departments
router.register(r'departments', DepartmentViewSet)

# Dashboard
Beispiel #47
0
    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 webServices.views import AlumnosViewSet, MateriaViewSet
from rest_framework.routers import DefaultRouter

router = DefaultRouter()
router.register(r'alumno',AlumnosViewSet)
router.register(r'materia',MateriaViewSet)

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', 'registro.views.listar'),
    url(r'^crearAlumno/$', 'registro.views.crearAlum'),
    url(r'^crearMateria/$', 'registro.views.crearMateria'),
    url(r'^modificarAlumno/$', 'registro.views.modificarAlumno'),
    url(r'^modificarMateria/$', 'registro.views.modificarMateria'),
    url(r'^eliminarAlumno/$', 'registro.views.eliminarAlumno'),
    url(r'^eliminarMateria/$', 'registro.views.eliminarMateria'),
	url(r'^eliminarAlum/$', 'registro.views.eliminarAlum'),
	url(r'^eliminarMat/$', 'registro.views.eliminarMat'),
    url(r'^matricular/$', 'registro.views.matricular'),
    url(r'^servicio/', include(router.urls)), 
from django.urls import path, include
from django.views.generic import TemplateView
from django.contrib.auth.decorators import login_required
from rest_framework.routers import DefaultRouter
from core.api import MessageModelViewSet, UserModelViewSet
import core.views

router = DefaultRouter()
router.register(r'message', MessageModelViewSet, basename='message-api')
router.register(r'user', UserModelViewSet, basename='user-api')

urlpatterns = [
    path(r'api/v1/', include(router.urls)),
    path('',
         login_required(TemplateView.as_view(template_name='core/chat.html')),
         name='home'),
    path('signup/', core.views.signup, name='signup'),
    path('logout/', core.views.logout_view, name='logout'),
    path('account_activation_sent/',
         core.views.account_activation_sent,
         name='account_activation_sent'),
    path(
        'activate/(?P<uidb64>[0-9A-Za-z_\-]+)/(?P<token>[0-9A-Za-z]{1,13}-[0-9A-Za-z]{1,20})/',
        core.views.activate,
        name='activate')
]
Beispiel #49
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path, include

from rest_framework.routers import DefaultRouter

from unicorn.views import UnicornViewSet

router = DefaultRouter()
router.register('unicorn', UnicornViewSet)

urlpatterns = [
    path('admin/', admin.site.urls),
    # Authentication
    path('o/', include('oauth2_provider.urls', namespace='oauth2_provider')),
    path('authentication/', include('users.urls')),
    # API
    path('v1/', include(router.urls)),
]
Beispiel #50
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .api import (SequenceViewSet, BioSampleViewSet, ProjectViewSet,
                  SeqFileViewSet, MetadataFileViewSet, MyFileUploadViewSet,
                  SequenceMetadataViewSet, SeqstatViewSet)
app_name = "mseq"
router = DefaultRouter()
router.register(r'sequence', SequenceViewSet, basename='sequence')
router.register(r'biosample', BioSampleViewSet, basename='biosample')
router.register(r'project', ProjectViewSet, basename='project')
router.register(r'seqstat', SeqstatViewSet, basename='seqstat')
router.register(r'seqfile', SeqFileViewSet, basename='seqfile')
router.register(r'metadatafile', MetadataFileViewSet, basename='metadatafile')
router.register(r'myfiles', MyFileUploadViewSet, basename='files')
router.register(r'sequence_metadata',
                SequenceMetadataViewSet,
                basename='sequence_metadata')

urlpatterns = [
    path('', include(router.urls)),
]
Beispiel #51
0
The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.0/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path,include
from api import views
from rest_framework.routers import DefaultRouter

# Creating Router Object
router = DefaultRouter()

#Register StudentViewSet with Router

router.register('studentapi', views.StudentModelViewSet, basename='student')


urlpatterns = [
    path('admin/', admin.site.urls),
    path('', include(router.urls)),
]
Beispiel #52
0
from snippets import views
from rest_framework.routers import DefaultRouter

urlpatterns = [
    url(r'^admin/', include(admin.site.urls), name='admin'),
    url(r'^home/$', HomePageView.as_view(), name='home'),
    url(r'^dashboard/1', DisplayOneView.as_view(), name='display1'),
    url(r'^dashboard/2', DisplayTwoView.as_view(), name='display2'),
    #url(r'^saltDemo/', SaltTestView.as_view(), name='display3'),
    #url(r'^zabbixDemo/', ZabbixDemoView.as_view(), name='display4'),
    url(r'^jqGridDemo/', jqGridDemoView.as_view(), name='display5'),
    url(r'^testSerializer/', serializerModule, name='serializerModule'),
    
    # 
    url(r'^at/', include('amazingTable.urls')),
]

router = DefaultRouter()
router.register(r'snippets', views.SnippetViewSet)
router.register(r'users', views.UserViewSet)
router.register(r'contents', views.ContentViewSet)

urlpatterns += [
    url(r'^', include(router.urls)),
    url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework'))
]
#AJAX
#urlpatterns += [
#    url(r'^saltajaxtest/', ajax_get_minion_statu, name='ajax_get_minion_statu'),
#]
Beispiel #53
0
from valve_insulation import views

from django.conf.urls import url, include

from rest_framework import renderers
from rest_framework.routers import DefaultRouter
from rest_framework.urlpatterns import format_suffix_patterns

# Create a router and register our viewsets with it.
router = DefaultRouter()
router.register(r'valve_insulation', views.ValveInsulationViewSet)

urlpatterns = [
        url(r'^', include(router.urls))
]
Beispiel #54
0
from django.conf.urls import url
from django.urls import path
from .views import *
from rest_framework.routers import DefaultRouter
from rest_framework.authtoken.views import obtain_auth_token

router = DefaultRouter()

router.register(r'user-login', LoginViewSet, basename="login")
router.register(r'user-signup', SignUpViewSet, basename="signup")

urlpatterns = router.urls
Beispiel #55
0
from rest_framework.routers import DefaultRouter
from Formularios.api.views import FormularioViewSet

from django.conf.urls import patterns, url, include

router = DefaultRouter()
router.register(r'formulario', FormularioViewSet)

urlpatterns = patterns('',
    url(r'^', include(router.urls)),
    )
Beispiel #56
0
# Django
from django.urls import include, path

# Django REST Framawork
from rest_framework.routers import DefaultRouter

# Views
from .views import BebidaViewSet
from .views import PlatilloViewSet
from .views import PostreViewSet

router = DefaultRouter()
router.register(r'bebidas', BebidaViewSet, basename='bebidas')
router.register(r'postres', PostreViewSet, basename='postres')
router.register(r'platillos', PlatilloViewSet, basename='platillos')

urlpatterns = [
    path('', include(router.urls)),
]
Beispiel #57
0
from django.conf.urls import patterns, url, include
from django.contrib import admin
from rest_framework.routers import DefaultRouter
import views

router = DefaultRouter()
router.register(r'learningrecord', views.LearningRecordViewSet)
router.register(r'socialrelationship', views.SocialRelationshipViewSet)
router.register(r'classification', views.ClassificationViewSet)
router.register(r'userclassification', views.UserClassificationViewSet)
#router.register(r'sna', views.SNARESTView, base_name="sna")

urlpatterns = patterns('',
    url(r'^register/$', views.register, name='register'),
    url(r'^eventregistration/$', views.eventregistration, name='eventregistration'),
    url(r'^socialmediaaccounts/$', views.socialmediaaccounts, name='socialmediaaccounts'),
    url(r'^sna/$', views.SNARESTView.as_view(), name='sna'),
    url(r'^wordcloud/$', views.WORDCLOUDView.as_view(), name='wordcloud'),
    url(r'^classificationpie/$', views.CLASSIFICATIONPieView.as_view(), name='classificationpie'),
    url(r'^topicmodel/$', views.TOPICMODELView.as_view(), name='topicmodel'),
    url(r'^classify/$', views.MLCLASSIFY.as_view(), name='classify'),
    url(r'^train/$', views.MLTRAIN.as_view(), name='train'),
    url(r'^externallinklog/$', views.EXTERNALLINKLOGView.as_view(), name='externallinklog'),
)
Beispiel #58
0
from django.urls import path, include
from rest_framework.routers import DefaultRouter
from .views import ProductViewSet, ImageView, OrderCreateView, \
                   FavouriteCreateView

router = DefaultRouter()
router.register('products', ProductViewSet, basename="Product")

urlpatterns = [
    path('', include(router.urls)),
    path('order/', OrderCreateView.as_view()),
    path('favourite/', FavouriteCreateView.as_view()),
    path('image', ImageView.as_view()),
    path('auth/', include('djoser.urls')),
    path('auth/', include('djoser.urls.jwt')),
]
Beispiel #59
0
)


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

if settings.DEBUG:
    import debug_toolbar
    urlpatterns += [
        url(r'^__debug__/', include(debug_toolbar.urls)),
    ]

router = DefaultRouter()

routes = {
    'matches': MatchViewSet,
    'moran': MoranViewSet,
    'strategies': StrategyViewSet,
    'tournaments': TournamentViewSet,
}

for route, viewset in routes.items():
    router.register(route, viewset, base_name=route)

urlpatterns += router.urls

urlpatterns = [
    url(r'axelrod/api/', include(urlpatterns)),
]
Beispiel #60
0
from django.urls import path
from rest_framework.routers import DefaultRouter

from .api import HospitalAreaViewSet, PriorityHospitalAreaViewSet, MinHospitalAreaViewSet, MinPriorityHospitalAreaViewSet

ROUTER = DefaultRouter()
ROUTER.register("hospital-priority-areas", PriorityHospitalAreaViewSet)
ROUTER.register("hospital-areas", HospitalAreaViewSet)
ROUTER.register("min-hospital-priority-areas", MinPriorityHospitalAreaViewSet)
ROUTER.register("min-hospital-areas", MinHospitalAreaViewSet)


urlpatterns = ROUTER.urls