add first template for location_data object
This commit is contained in:
parent
d8df0dec1c
commit
1d0da1eb27
@ -1,3 +1,12 @@
|
||||
{% load static %}
|
||||
<html>
|
||||
<head>
|
||||
<title>Test</title>
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'billard/css/bootstrap.css' %}" />
|
||||
</head>
|
||||
<body>
|
||||
{% block content %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<link rel="stylesheet" type="text/css" href="{% static 'billard/css/bootstrap.min.css' %}" />
|
15
billard/templates/billard/locationdata_list.html
Normal file
15
billard/templates/billard/locationdata_list.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends 'billard/base.html' %}
|
||||
|
||||
{% block content %}
|
||||
{% if object_list %}
|
||||
<ul>
|
||||
{% for location_data in object_list %}
|
||||
<li><a href="/location_data/{{ location_data.id }}/">{{ location_data.location_id }}</a></li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
{% else %}
|
||||
<p>No data available.</p>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
|
@ -9,5 +9,6 @@ router.register(r'tables', views.TableViewSet)
|
||||
router.register(r'location_data', views.LocationDataViewSet)
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.IndexView.as_view(), name='index'),
|
||||
url(r'api/v1/', include(router.urls)),
|
||||
]
|
||||
|
@ -1,5 +1,7 @@
|
||||
from billard.serializers import *
|
||||
from .models import LocationData
|
||||
from rest_framework import viewsets
|
||||
from django.views import generic
|
||||
|
||||
|
||||
class ClientViewSet(viewsets.ModelViewSet):
|
||||
@ -20,3 +22,8 @@ class TableViewSet(viewsets.ModelViewSet):
|
||||
class LocationDataViewSet(viewsets.ModelViewSet):
|
||||
queryset = LocationData.objects.all()
|
||||
serializer_class = LocationDataSerializer
|
||||
|
||||
|
||||
class IndexView(generic.ListView):
|
||||
model = LocationData
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user