From ce0143b274c965af4a79a82b9e2bc6d19e1a238d Mon Sep 17 00:00:00 2001 From: Andreas Zweili Date: Mon, 25 Dec 2017 13:31:29 +0100 Subject: [PATCH] define url patterns for various views --- docs/docs.org | 24 ++++++++++++++++++++++++ inventory/urls.py | 16 ++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 inventory/urls.py diff --git a/docs/docs.org b/docs/docs.org index fdb3846..a1a8691 100644 --- a/docs/docs.org +++ b/docs/docs.org @@ -426,6 +426,30 @@ urlpatterns = [ path('admin/', admin.site.urls), ] #+END_SRC + +** inventory/urls.py + +Contains the url definitions for the inventory application. For the +moment the inventory is my only application so all the URLs will start +from the root. + +#+BEGIN_SRC python :tangle ../inventory/urls.py +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^$', views.index, name='index'), + url(r'^device/(?P[0-9]+)/$', + views.device_details, + name='device'), + url(r'^computer/(?P[0-9]+)/$', + views.computer_details, + name='computer'), + url(r'^cronjob/(?P[0-9]+)/$', + views.cronjob_details, + name='cronjob'), + ] #+END_SRC * Templates diff --git a/inventory/urls.py b/inventory/urls.py new file mode 100644 index 0000000..5680e79 --- /dev/null +++ b/inventory/urls.py @@ -0,0 +1,16 @@ +from django.conf.urls import url + +from . import views + +urlpatterns = [ + url(r'^$', views.index, name='index'), + url(r'^device/(?P[0-9]+)/$', + views.device_details, + name='device'), + url(r'^computer/(?P[0-9]+)/$', + views.computer_details, + name='computer'), + url(r'^cronjob/(?P[0-9]+)/$', + views.cronjob_details, + name='cronjob'), + ]