add command to process location data
This commit is contained in:
parent
222367a6a2
commit
81d9b7f29c
@ -1,4 +1,8 @@
|
|||||||
from django.contrib import admin
|
from django.conf.urls import url
|
||||||
|
from django.contrib import admin, messages
|
||||||
|
from django.shortcuts import redirect
|
||||||
|
from django.template.response import TemplateResponse
|
||||||
|
|
||||||
from .models import *
|
from .models import *
|
||||||
from django import forms
|
from django import forms
|
||||||
from django.core.exceptions import ValidationError
|
from django.core.exceptions import ValidationError
|
||||||
@ -33,6 +37,16 @@ class ClientAdmin(admin.ModelAdmin):
|
|||||||
|
|
||||||
@admin.register(LocationData)
|
@admin.register(LocationData)
|
||||||
class LocationDataAdmin(admin.ModelAdmin):
|
class LocationDataAdmin(admin.ModelAdmin):
|
||||||
|
def get_urls(self):
|
||||||
|
urls = super().get_urls()
|
||||||
|
my_urls = [
|
||||||
|
url(r'^process_locationdata/$', self.admin_site.admin_view(self.process_locationdata), name='process_locationdata'),
|
||||||
|
]
|
||||||
|
return my_urls + urls
|
||||||
|
|
||||||
|
def process_locationdata(self, request):
|
||||||
|
messages.success(request, '2739847239847298374982374 Items prozessiert.')
|
||||||
|
return redirect('admin:billard_locationdata_changelist')
|
||||||
list_display = ('client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg')
|
list_display = ('client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg')
|
||||||
fields = ['client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg']
|
fields = ['client_id', 'desk_no', 'tst', 'on_off', 'processed', 'error_msg']
|
||||||
|
|
||||||
|
@ -0,0 +1,10 @@
|
|||||||
|
{% extends "admin/change_list.html" %}
|
||||||
|
{% load i18n admin_urls static admin_list %}
|
||||||
|
{% block object-tools-items %}
|
||||||
|
<li>
|
||||||
|
<a href="{% url 'admin:process_locationdata' %}">
|
||||||
|
LD Verarbeiten
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{{ block.super }}
|
||||||
|
{% endblock %}
|
@ -4,7 +4,7 @@ from rest_framework import routers
|
|||||||
from billard import views
|
from billard import views
|
||||||
|
|
||||||
router = routers.DefaultRouter()
|
router = routers.DefaultRouter()
|
||||||
router.register(r'location_data', views.LocationDataViewSet)
|
router.register(r'locationdata', views.LocationDataViewSet)
|
||||||
|
|
||||||
app_name = 'billard'
|
app_name = 'billard'
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import ast
|
import ast
|
||||||
|
import logging
|
||||||
|
|
||||||
from billard.serializers import LocationDataSerializer
|
from billard.serializers import LocationDataSerializer
|
||||||
from billard.models import LocationData, Location, Client, Accounting
|
from billard.models import LocationData, Location, Client, Accounting
|
||||||
@ -13,6 +14,9 @@ from django.utils.decorators import method_decorator
|
|||||||
from django.utils import timezone
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
|
log = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|
||||||
class LocationIndexView(generic.ListView):
|
class LocationIndexView(generic.ListView):
|
||||||
template_name = 'billard/location_index.html'
|
template_name = 'billard/location_index.html'
|
||||||
context_object_name = 'location_list'
|
context_object_name = 'location_list'
|
||||||
|
@ -5,7 +5,7 @@ from datetime import datetime
|
|||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
|
||||||
url = 'http://127.0.0.1:8000/billard/api/v1/location_data/'
|
url = 'http://127.0.0.1:8000/billard/api/v1/locationdata/'
|
||||||
client_id = '28a34fa1-7b62-4b78-8d2a-ada4db4ac6ea'
|
client_id = '28a34fa1-7b62-4b78-8d2a-ada4db4ac6ea'
|
||||||
token = '588d0f4c4b8b90b507e6d5c0ea26f0e28b021262'
|
token = '588d0f4c4b8b90b507e6d5c0ea26f0e28b021262'
|
||||||
default_desk_id = 2
|
default_desk_id = 2
|
||||||
|
Loading…
Reference in New Issue
Block a user