diff --git a/billard/templates/billard/locationdata_detail.html b/billard/templates/billard/locationdata_detail.html new file mode 100644 index 0000000..de332c9 --- /dev/null +++ b/billard/templates/billard/locationdata_detail.html @@ -0,0 +1,57 @@ +{% extends 'billard/base.html' %} + +{% block title %}Location Data{% endblock %} + +{% block content %} +

Locationdata: {{ locationdata.id }}

+ + {% if error_message %}

{{ error_message }}

{% endif %} + +
+ {% csrf_token %} +
+ +
+ +
+
+ +
+ +
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + Zurück + +{% endblock %} + + diff --git a/billard/templates/billard/locationdata_list.html b/billard/templates/billard/locationdata_list.html index 46853a5..f4fd71d 100644 --- a/billard/templates/billard/locationdata_list.html +++ b/billard/templates/billard/locationdata_list.html @@ -17,7 +17,7 @@ {% for location_data in object_list %} - {{ location_data.id }} + {{ location_data.id }} {{ location_data.location_id }} {{ location_data.table_no }} {{ location_data.tst }} diff --git a/billard/urls.py b/billard/urls.py index 8e55874..33497af 100644 --- a/billard/urls.py +++ b/billard/urls.py @@ -10,5 +10,6 @@ router.register(r'location_data', views.LocationDataViewSet) urlpatterns = [ url(r'^$', views.IndexView.as_view(), name='index'), + url(r'^(?P[0-9]+)/$', views.LocationDataDetailView.as_view(), name='detail'), url(r'api/v1/', include(router.urls)), ] diff --git a/billard/views.py b/billard/views.py index 069bf13..d7d2b8c 100644 --- a/billard/views.py +++ b/billard/views.py @@ -2,6 +2,7 @@ from billard.serializers import * from .models import LocationData from rest_framework import viewsets from django.views import generic +from django.views.generic.detail import DetailView class ClientViewSet(viewsets.ModelViewSet): @@ -27,3 +28,6 @@ class LocationDataViewSet(viewsets.ModelViewSet): class IndexView(generic.ListView): model = LocationData + +class LocationDataDetailView(DetailView): + model = LocationData diff --git a/caromserver/urls.py b/caromserver/urls.py index ffcdb96..a8a57cd 100644 --- a/caromserver/urls.py +++ b/caromserver/urls.py @@ -15,9 +15,11 @@ Including another URLconf """ from django.conf.urls import url, include from django.contrib import admin +from django.views.generic import RedirectView urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^billard/', include('billard.urls')), + url(r'^.*$', RedirectView.as_view(url='billard/', permanent=False), name='index') ]