From db9be39f7679c0ffccc9ce75005f39db7e964719 Mon Sep 17 00:00:00 2001 From: Julien Malka Date: Mon, 17 Feb 2020 11:40:58 +0100 Subject: [PATCH] Added journal --- cof/settings/common.py | 1 + cof/urls.py | 4 ++ gestioncof/templates/gestioncof/home.html | 18 ++++++++ journaldecaisse/apps.py | 3 +- journaldecaisse/models.py | 6 +-- .../templates/journaldecaisse/index.html | 45 +++++++++++++++++++ journaldecaisse/urls.py | 1 + journaldecaisse/views.py | 7 ++- 8 files changed, 79 insertions(+), 6 deletions(-) create mode 100644 journaldecaisse/templates/journaldecaisse/index.html diff --git a/cof/settings/common.py b/cof/settings/common.py index ecf464fe..dd80a7b3 100644 --- a/cof/settings/common.py +++ b/cof/settings/common.py @@ -75,6 +75,7 @@ INSTALLED_APPS = [ "django.contrib.admindocs", "bda", "petitscours", + "journaldecaisse.apps.JournaldecaisseConfig", "captcha", "django_cas_ng", "bootstrapform", diff --git a/cof/urls.py b/cof/urls.py index 374c0f1a..9b24f932 100644 --- a/cof/urls.py +++ b/cof/urls.py @@ -16,6 +16,8 @@ from wagtail.admin import urls as wagtailadmin_urls from wagtail.core import urls as wagtail_urls from wagtail.documents import urls as wagtaildocs_urls + + from gestioncof import csv_views, views as gestioncof_views from gestioncof.autocomplete import autocomplete from gestioncof.urls import ( @@ -43,6 +45,8 @@ urlpatterns = [ path("event/", include(events_patterns)), # Calendrier path("calendar/", include(calendar_patterns)), + #Journal de Caisse + path('journaldecaisse/', include('journaldecaisse.urls', namespace="journaldecaisse")), # Clubs path("clubs/", include(clubs_patterns)), # Authentification diff --git a/gestioncof/templates/gestioncof/home.html b/gestioncof/templates/gestioncof/home.html index e534f687..bbaeae44 100644 --- a/gestioncof/templates/gestioncof/home.html +++ b/gestioncof/templates/gestioncof/home.html @@ -91,6 +91,24 @@ {% endfor %} + +

Journal de Caisse

+
+ + +

Gestion tirages BdA

{% if active_tirages %} diff --git a/journaldecaisse/apps.py b/journaldecaisse/apps.py index 212746e5..7d4c1ff1 100644 --- a/journaldecaisse/apps.py +++ b/journaldecaisse/apps.py @@ -2,4 +2,5 @@ from django.apps import AppConfig class JournaldecaisseConfig(AppConfig): - name = 'journaldecaisse' + + name = "journaldecaisse" diff --git a/journaldecaisse/models.py b/journaldecaisse/models.py index e4d69200..22423e05 100644 --- a/journaldecaisse/models.py +++ b/journaldecaisse/models.py @@ -2,9 +2,9 @@ from django.db import models from django.utils.translation import ugettext_lazy as _ PAYMENTS_CHOICES = ( - ("cash", _("Espèces")), - ("cb", _("CB")), - ("check", _("Chèque")), + ("Espèces", _("Espèces")), + ("CB", _("CB")), + ("Chèque", _("Chèque")), ) class JournalEntry(models.Model): diff --git a/journaldecaisse/templates/journaldecaisse/index.html b/journaldecaisse/templates/journaldecaisse/index.html new file mode 100644 index 00000000..7e2093ab --- /dev/null +++ b/journaldecaisse/templates/journaldecaisse/index.html @@ -0,0 +1,45 @@ +{% extends "petitscours/base_title.html" %} +{% load staticfiles %} + +{% block realcontent %} +

Journal de Kaisse

+{% if entry_list %} + + + + + + + + + + {% for entry in entry_list %} + + + + + + + + {% endfor %} + +
DateCofeux.seObjetMoyen de PaiementMontant
{{ entry.entry_date|date:"M d, Y" }}{{ entry.cofeux_id }}{{ entry.entry_text }} {{ entry.payment_type}} {{ entry.entry_amount }}€
+ {% if is_paginated %} + + {% endif %} +{% else %} +

Aucune demande :(

+{% endif %} +{% endblock %} diff --git a/journaldecaisse/urls.py b/journaldecaisse/urls.py index 3ef24d97..c7547dc2 100644 --- a/journaldecaisse/urls.py +++ b/journaldecaisse/urls.py @@ -2,6 +2,7 @@ from django.urls import path from . import views +app_name = 'journaldecaisse' urlpatterns = [ path('', views.index, name='index'), ] \ No newline at end of file diff --git a/journaldecaisse/views.py b/journaldecaisse/views.py index 94bc3189..a7add974 100644 --- a/journaldecaisse/views.py +++ b/journaldecaisse/views.py @@ -1,5 +1,8 @@ from django.http import HttpResponse - +from .models import JournalEntry +from django.shortcuts import render def index(request): - return HttpResponse("Hello, world. You're at the polls index.") \ No newline at end of file + entry_list = JournalEntry.objects.order_by('entry_date') + context = {'entry_list': entry_list} + return render(request, 'journaldecaisse/index.html', context) \ No newline at end of file