Merge branch 'release/0.1.1'

This commit is contained in:
Robert Einsle 2017-04-12 13:21:55 +02:00
commit 69a58ad9a3
4 changed files with 37 additions and 1 deletions

View File

@ -0,0 +1,32 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-04-10 18:53
from __future__ import unicode_literals
from django.db import migrations
def create_default_groups_permissions(apps, schema_editor):
# We can't import the Person model directly as it may be a newer
# version than this migration expects. We use the historical version.
Permission = apps.get_model("auth", "Permission")
Group = apps.get_model("auth", "Group")
lg = Group(name='Location')
lg.save()
lg.permissions.add(Permission.objects.get(codename="add_locationdata"))
ag = Group(name='Accounting')
ag.save()
ag.permissions.add(Permission.objects.get(codename="change_accounting"))
def delete_default_groups_permissions(apps, schema_editor):
Group = apps.get_model("auth", "Group")
Group.objects.get(name='Location').delete()
Group.objects.get(name='Accounting').delete()
class Migration(migrations.Migration):
dependencies = [
('billard', '0019_merge_20170310_1941'),
]
operations = [
migrations.RunPython(create_default_groups_permissions, delete_default_groups_permissions),
]

View File

@ -53,6 +53,7 @@ def process_location_data():
hh_end=cli.location.happy_hour_end,
pphh=desk.prize_hh,
)
acc.reporter_uuid = cli.uuid
acc.save()
ld.delete()
else:

View File

@ -29,7 +29,9 @@
<div id="navbar" class="collapse navbar-collapse">
<ul class="nav navbar-nav">
<li class="{% ifequal request.path '/billard/' %}active{% endifequal %}"><a href="{% url "carom_index" %}">Tische</a></li>
{% if perms.billard.change_accounting %}
<li class="{% ifequal request.path '/billard/accounting' %}active{% endifequal %}"><a href="{% url "accounting" %}">Abrechnung</a></li>
{% endif %}
{% if user.is_superuser %}
<li class="{% ifequal request.path '/logout/' %}active{% endifequal %}"><a href="/admin/">Administration</a></li>
{% endif %}

View File

@ -5,7 +5,7 @@ from rest_framework import viewsets
from django.shortcuts import render, redirect
from django.views import generic
from django.views.generic.detail import DetailView
from django.contrib.auth.decorators import login_required
from django.contrib.auth.decorators import login_required, permission_required
from django.db.models import Min, Sum
from django.http import HttpResponse
@ -56,6 +56,7 @@ def accountmodalconfirmview(request, pk):
@login_required
@permission_required('billard.change_accounting')
def accounting(request):
if request.method == 'GET':
template = 'billard/accounting.html'