Example #1
0
from django.urls import path
from django.contrib import admin
from data_collector.views import StatusView, AlertListView, NewAlertView, EditAlertView, DeleteAlertView, RecordDataApiView
from django.views.decorators.csrf import csrf_exempt

urlpatterns = [
    path('admin/', admin.site.urls),
    path('', StatusView.as_view(), name='status'),
    path('alerts/', AlertListView.as_view(), name='alerts-list'),
    path('alerts/new/', NewAlertView.as_view(), name='alerts-new'),
    path('alerts/<int:pk>/edit/', EditAlertView.as_view(), name='alerts-edit'),
    path('alerts/<int:pk>/delete/',
         DeleteAlertView.as_view(), name='alerts-delete'),
    path('record/', csrf_exempt(RecordDataApiView.as_view()), name='record-data'),
]
from django.conf.urls import url
from django.views.decorators.csrf import csrf_exempt

from data_collector.views import RecordDataApiView

from data_collector.views import StatusView
from data_collector.views import AlertListView
from data_collector.views import NewAlertView
from data_collector.views import EditAlertView
from data_collector.views import DeleteAlertView


urlpatterns = [
    url(r'^$', StatusView.as_view(), name='status'),

    url(r'^alerts/$', AlertListView.as_view(), name='alerts-list'),
    url(r'^alerts/new/$', NewAlertView.as_view(), name='alerts-new'),
	url(r'^alerts/(?P<pk>\d+)/edit/$', EditAlertView.as_view(), name='alerts-edit'),
	url(r'^alerts/(?P<pk>\d+)/delete/$', DeleteAlertView.as_view(), name='alerts-delete'),
	url(r'^record/$', csrf_exempt(RecordDataApiView.as_view()), name='record-data'),

]
Example #3
0
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. Add an import:  from blog import urls as blog_urls
    2. Import the include() function: from django.conf.urls import url, include
    3. Add a URL to urlpatterns:  url(r'^blog/', include(blog_urls))
"""
from django.conf.urls import url
from django.contrib import admin
from django.views.decorators.csrf import csrf_exempt

from data_collector.views import StatusView, AlertListView, NewAlertView, \
    EditAlertView, DeleteAlertView, RecordDataApiView

urlpatterns = [
    url(r'^admin/', admin.site.urls),
    url(r'^$', StatusView.as_view(), name='status'),
    url(r'^alerts/$', AlertListView.as_view(), name='alerts-list'),
    url(r'^alerts/new/$', NewAlertView.as_view(), name='alerts-new'),
    url(r'^alerts/(?P<pk>\d+)/edit/$',
        EditAlertView.as_view(),
        name='alerts-edit'),
    url(r'^alerts/(?P<pk>\d+)/delete/$',
        DeleteAlertView.as_view(),
        name='alerts-delete'),
    url(r'^record/$',
        csrf_exempt(RecordDataApiView.as_view()),
        name='record-data'),
]
Example #4
0
        SubmissionDetailView.as_view(),
        name='submission-detail'),
    url(r'^new-comment/$', NewCommentView.as_view(), name='new-comment'),
    url(r'^new-comment-reply/$',
        NewCommentReplyView.as_view(),
        name='new-comment-reply'),
    # votes
    url(r'^upvote/(?P<link_pk>\d+)/$',
        UpvoteSubmissionView.as_view(),
        name='upvote-submission'),
    url(r'^upvote/(?P<link_pk>\d+)/remove/$',
        RemovevoteSubmissionView.as_view(),
        name='remove-upvote-submission'),

    # data_collector
    url(r'^data_collector/$', StatusView.as_view(), name='status'),
    url(r'^data_collector/alerts/$',
        AlertListView.as_view(),
        name='alerts_list'),
    url(r'^data_collector/new-alert/$',
        CreateAlertView.as_view(),
        name='new_alert'),
    url(r'^data_collector/(?P<pk>\d+)/update-alert/$',
        UpdateAlertView.as_view(),
        name='update_alert'),
    url(r'^data_collector/(?P<pk>\d+)/delete-alert/$',
        DeleteAlertView.as_view(),
        name='delete_alert'),
    # The csrf_exempt decorator is used because, by default, Django uses CSRF protection for POST requests.
    url(r'^record/$', csrf_exempt(RecordDataApiView.as_view()), name='record'),
Example #5
0
from django.urls import path, include
from django.contrib import admin
from django.views.decorators.csrf import csrf_exempt

from data_collector.views import (
    StatusView,
    AlertListView,
    NewAlertView,
    EditAlertView,
    DeleteAlertView,
    RecordDataApiView,
)

urlpatterns = [
    path('admin', admin.site.urls),
    path('', StatusView.as_view(), name='home'),
    path('alerts/', AlertListView.as_view(), name='alerts'),
    path('alerts/new/', NewAlertView.as_view(), name='alert-new'),
    path('alerts/<int:pk>/edit/', EditAlertView.as_view(), name='alert-edit'),
    path('alerts/<int:pk>/delete/',
         DeleteAlertView.as_view(),
         name='alert-delete'),
    path('record/',
         csrf_exempt(RecordDataApiView.as_view()),
         name='record-data'),
]