Ejemplo n.º 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'),

]
Ejemplo n.º 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'),
]
Ejemplo n.º 4
0
    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'),

    # car rental
    url(r'^car/', include('carrental.urls'))
Ejemplo n.º 5
0
from rest_framework import routers
# router = routers.SimpleRouter()

router = DefaultRouter()
router.register(r'nginx',views.NginxViewSet)
router.register(r'status',views.StatusAPIView)


urlpatterns = [
    # url(r'^', include('data_collector.urls',namespace="collector")),
    url(r'^admin/', admin.site.urls),
    url(r'^login/$', login_view, name='login'),
    url(r'^logout/$', logout_view, name='logout'),

    # url(r'^$', login_required(StatusView.as_view()), name='status'),
    url(r'^alerts/$', login_required(AlertListView.as_view()), name='alerts-list'),
    url(r'^alerts/new/$', login_required(NewAlertView.as_view()), name='alerts-new'),
    url(r'^alerts/(?P<pk>\d+)/edit/$', login_required(EditAlertView.as_view()),name='alerts-edit'),
    url(r'^alerts/(?P<pk>\d+)/delete/$', login_required(DeleteAlertView.as_view()),name='alerts-delete'),
    url(r'^record/$', csrf_exempt(RecordDataApiView.as_view()),name='record-data'),
    url(r'^select/$', SelectDataApiView.as_view(),name='Select-data'),
    url(r'^datatype/$', DataTypeApiView.as_view(),name='datatype'),
    url(r'^hosts/$', login_required(HostListView.as_view()), name='hosts-list'),
    url(r'^(?P<id>\d+)/$', HostDetailView, name='hosts-detail'),
    url(r'^profile_edit/$', profile_edit, name='profile_edit'),
    url(r'^api/',include(router.urls,namespace='api')),
    url(r'^api-auth/',include('rest_framework.urls',namespace='rest_framework')),
    url(r'^nginx/',Status.as_view(),name='nginx-ajax'),
    url(r'^statustype/',statusTypeApi.as_view(),name='status-type'),
    url(r'^ipapi/',ipApi.as_view(),name='ip-api'),
    # url(r'^iplist/',ipListView.as_view(),name='ip-list'),