Add myAccount view

This commit is contained in:
2018-02-13 08:38:17 +01:00
parent 679a831b7d
commit f952204606
5 changed files with 48 additions and 1 deletions

View File

@@ -8,11 +8,15 @@ from django.shortcuts import render, redirect
from django.utils import timezone
from django.utils.decorators import method_decorator
from django.views import generic
from django.views.generic import UpdateView
from django.urls import reverse_lazy
from rest_framework import viewsets
from billard.models import LocationData, Location, Client, Accounting
from billard.serializers import LocationDataSerializer, ClientUpdateLastSeenSerializer
from billard.tasks import process_location_data
from .forms import UserInformationUpdateForm
log = logging.getLogger(__name__)
@@ -113,6 +117,16 @@ class ClientUpdateLastSeenViewSet(viewsets.ModelViewSet):
serializer_class = ClientUpdateLastSeenSerializer
@method_decorator(login_required, name='dispatch')
class UserUpdateView(UpdateView):
form_class = UserInformationUpdateForm
template_name = 'registration/my_account.html'
success_url = reverse_lazy('billard:my_account')
def get_object(self):
return self.request.user
def process_location_data(request):
process_location_data()
return HttpResponse('DONE')