Merge branch 'develop' of git.wolke.einsle.de:carom/carom-server into develop

This commit is contained in:
Robert Einsle 2017-01-27 09:37:31 +01:00
commit 16d181c8ce
10 changed files with 10429 additions and 16 deletions

View File

@ -23,4 +23,3 @@ class LocationDataAdmin(admin.ModelAdmin):
list_display = ('location_id', 'table_no', 'tst', 'on_off', 'processed', 'error_msg') list_display = ('location_id', 'table_no', 'tst', 'on_off', 'processed', 'error_msg')
fields = ['location_id', 'table_no', 'tst', 'on_off', 'processed', 'error_msg'] fields = ['location_id', 'table_no', 'tst', 'on_off', 'processed', 'error_msg']
pass pass

View File

@ -39,7 +39,7 @@ class LocationData(models.Model):
table_no = models.IntegerField(blank=False, null=False) table_no = models.IntegerField(blank=False, null=False)
tst = models.DateTimeField(blank=False, null=False) tst = models.DateTimeField(blank=False, null=False)
on_off = models.BooleanField(blank=False, null=False) on_off = models.BooleanField(blank=False, null=False)
processed = models.BooleanField(blank=False, null=False, default=False) processed = models.BooleanField(default=False)
error_msg = models.CharField(max_length=16000, blank=True, null=True) error_msg = models.CharField(max_length=16000, blank=True, null=True)
def __str__(self): def __str__(self):

10351
billard/static/billard/js/jquery-1.11.3.js vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -41,8 +41,7 @@
{% endblock %} {% endblock %}
</div> </div>
</div><!-- /.container --> </div><!-- /.container -->
<script src="{% static 'billard/js/jquery-1.11.3.js' %}"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> <script src="{% static 'billard/js/bootstrap.min.js' %}"></script>
<script src="js/bootstrap.min.js"></script>
</body> </body>
</html> </html>

View File

@ -0,0 +1,57 @@
{% extends 'billard/base.html' %}
{% block title %}Location Data{% endblock %}
{% block content %}
<h1>Locationdata: {{ locationdata.id }}</h1>
{% if error_message %}<p><strong>{{ error_message }}</strong></p>{% endif %}
<form action="{% url 'index' %}" method="post" class="form-horizontal">
{% csrf_token %}
<div class="form-group">
<label for="location_id" class="col-sm-2 control-label">Location Id</label>
<div class="col-sm-10">
<input id="location_id" type="text" name="location_id" value="{{ locationdata.location_id }}"
placeholder="Locaton" class="form-control" disabled="disabled"/>
</div>
<div class="form-group">
<label for="table_no" class="col-sm-2 control-label">Table Number</label>
<div class="col-sm-10">
<input id="table_no" type="number" name="table_no" value="{{ locationdata.table_no }}"
placeholder="Table" class="form-control" min="1" max="8" disabled="disabled"/>
</div>
<div class="form-group">
<label for="tst" class="col-sm-2 control-label">Timestamp</label>
<div class="col-sm-10">
<input id="tst" type="datetime" name="tst" value="{{ locationdata.tst }}"
placeholder="Table" class="form-control" disabled="disabled"/>
</div>
</div>
<div class="form-group">
<label for="on_off" class="col-sm-2 control-label">On / Off</label>
<div class="col-sm-10">
<input id="on_off" type="checkbox" name="on_off" value="{{ locationdata.on_off }}"
placeholder="Table" class="form-control" disabled="disabled"/>
</div>
</div>
<div class="form-group">
<label for="processed" class="col-sm-2 control-label">Processed</label>
<div class="col-sm-10">
<input id="processed" type="checkbox" name="processed" value="{{ locationdata.processed }}"
placeholder="Table" class="form-control" disabled="disabled"/>
</div>
</div>
<div class="form-group">
<label for="error_msg" class="col-sm-2 control-label">Error Message</label>
<div class="col-sm-10">
<input id="error_msg" type="text" name="error_msg" value="{{ locationdata.error_msg }}"
placeholder="Table" class="form-control" disabled="disabled"/>
</div>
</div>
<button type="submit" class="btn btn-default">Abschicken</button>
<a class="btn btn-default" href=".." role="button">Zurück</a>
</form>
{% endblock %}

View File

@ -17,7 +17,7 @@
</tr> </tr>
{% for location_data in object_list %} {% for location_data in object_list %}
<tr> <tr>
<td>{{ location_data.id }}</td> <td><a href="{% url 'detail' location_data.id %}">{{ location_data.id }}</a></td>
<td>{{ location_data.location_id }}</td> <td>{{ location_data.location_id }}</td>
<td>{{ location_data.table_no }}</td> <td>{{ location_data.table_no }}</td>
<td>{{ location_data.tst }}</td> <td>{{ location_data.tst }}</td>

View File

@ -10,5 +10,6 @@ router.register(r'location_data', views.LocationDataViewSet)
urlpatterns = [ urlpatterns = [
url(r'^$', views.IndexView.as_view(), name='index'), url(r'^$', views.IndexView.as_view(), name='index'),
url(r'^(?P<pk>[0-9]+)/$', views.LocationDataDetailView.as_view(), name='detail'),
url(r'api/v1/', include(router.urls)), url(r'api/v1/', include(router.urls)),
] ]

View File

@ -2,6 +2,7 @@ from billard.serializers import *
from .models import LocationData from .models import LocationData
from rest_framework import viewsets from rest_framework import viewsets
from django.views import generic from django.views import generic
from django.views.generic.detail import DetailView
class ClientViewSet(viewsets.ModelViewSet): class ClientViewSet(viewsets.ModelViewSet):
@ -27,3 +28,6 @@ class LocationDataViewSet(viewsets.ModelViewSet):
class IndexView(generic.ListView): class IndexView(generic.ListView):
model = LocationData model = LocationData
class LocationDataDetailView(DetailView):
model = LocationData

View File

@ -15,7 +15,6 @@ import os
# Build paths inside the project like this: os.path.join(BASE_DIR, ...) # Build paths inside the project like this: os.path.join(BASE_DIR, ...)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
# Quick-start development settings - unsuitable for production # Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/ # See https://docs.djangoproject.com/en/1.10/howto/deployment/checklist/
@ -27,7 +26,6 @@ DEBUG = True
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
# Application definition # Application definition
INSTALLED_APPS = [ INSTALLED_APPS = [
@ -72,7 +70,6 @@ TEMPLATES = [
WSGI_APPLICATION = 'caromserver.wsgi.application' WSGI_APPLICATION = 'caromserver.wsgi.application'
# Database # Database
# https://docs.djangoproject.com/en/1.10/ref/settings/#databases # https://docs.djangoproject.com/en/1.10/ref/settings/#databases
@ -116,7 +113,6 @@ USE_L10N = True
USE_TZ = True USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.10/howto/static-files/ # https://docs.djangoproject.com/en/1.10/howto/static-files/
@ -127,7 +123,12 @@ REST_FRAMEWORK = {
# or allow read-only access for unauthenticated users. # or allow read-only access for unauthenticated users.
'DEFAULT_PERMISSION_CLASSES': [ 'DEFAULT_PERMISSION_CLASSES': [
'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly' 'rest_framework.permissions.DjangoModelPermissionsOrAnonReadOnly'
] ],
'DEFAULT_AUTHENTICATION_CLASSES': (
'rest_framework.authentication.BasicAuthentication',
'rest_framework.authentication.SessionAuthentication',
'rest_framework.authentication.TokenAuthentication',
),
} }
STATIC_ROOT = "/srv/carom/carom-server/static/" STATIC_ROOT = "/srv/carom/carom-server/static/"
@ -141,4 +142,3 @@ try:
from caromserver.local_settings import * from caromserver.local_settings import *
except ImportError: except ImportError:
pass pass

View File

@ -15,9 +15,11 @@ Including another URLconf
""" """
from django.conf.urls import url, include from django.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
from django.views.generic import RedirectView
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')),
url(r'^billard/', include('billard.urls')), url(r'^billard/', include('billard.urls')),
url(r'^.*$', RedirectView.as_view(url='billard/', permanent=False), name='index')
] ]