From 7bafbeb93a2aa9e39e0ab926d706e4fffb823ca9 Mon Sep 17 00:00:00 2001 From: Alexandre Iooss Date: Wed, 17 Jul 2019 13:34:07 +0200 Subject: [PATCH] The beginning of transfer view --- note/locale/fr/LC_MESSAGES/django.po | 68 ++++++++++++++++----------- note/templates/note/transfer.html | 10 ++++ note/urls.py | 12 +++++ note/views.py | 23 +++++++++ note_kfet/urls.py | 7 ++- theme/locale/fr/LC_MESSAGES/django.po | 6 +-- theme/templates/admin/base_site.html | 8 ++-- 7 files changed, 97 insertions(+), 37 deletions(-) create mode 100644 note/templates/note/transfer.html create mode 100644 note/urls.py create mode 100644 note/views.py diff --git a/note/locale/fr/LC_MESSAGES/django.po b/note/locale/fr/LC_MESSAGES/django.po index 4d9e7471..e229be12 100644 --- a/note/locale/fr/LC_MESSAGES/django.po +++ b/note/locale/fr/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-17 11:51+0200\n" +"POT-Creation-Date: 2019-07-17 13:32+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -13,7 +13,16 @@ msgstr "" "Content-Transfer-Encoding: 8bit\n" "Plural-Forms: nplurals=2; plural=(n > 1);\n" -#: apps.py:11 models/notes.py:41 +#: admin.py:113 models/transactions.py:46 +msgid "source" +msgstr "source" + +#: admin.py:121 admin.py:139 models/transactions.py:25 +#: models/transactions.py:52 +msgid "destination" +msgstr "destination" + +#: apps.py:11 models/notes.py:45 msgid "note" msgstr "note" @@ -40,73 +49,72 @@ msgstr "" msgid "display image" msgstr "image affichée" -#: models/notes.py:42 +#: models/notes.py:40 models/transactions.py:55 +msgid "created at" +msgstr "créée le" + +#: models/notes.py:46 msgid "notes" msgstr "notes" -#: models/notes.py:53 -msgid "user" -msgstr "" - #: models/notes.py:57 +msgid "user" +msgstr "utilisateur" + +#: models/notes.py:61 msgid "one's note" msgstr "note d'un utilisateur" -#: models/notes.py:58 +#: models/notes.py:62 msgid "users note" msgstr "notes des utilisateurs" -#: models/notes.py:61 +#: models/notes.py:65 #, python-format msgid "%(user)s's note" msgstr "Note de %(user)s" -#: models/notes.py:72 +#: models/notes.py:76 msgid "club" msgstr "club" -#: models/notes.py:76 +#: models/notes.py:80 msgid "club note" msgstr "note d'un club" -#: models/notes.py:77 +#: models/notes.py:81 msgid "clubs notes" msgstr "notes des clubs" -#: models/notes.py:80 +#: models/notes.py:84 #, python-format msgid "Note for %(club)s club" msgstr "Note du club %(club)s" -#: models/notes.py:93 models/transactions.py:32 models/transactions.py:65 +#: models/notes.py:97 models/transactions.py:32 models/transactions.py:65 msgid "type" msgstr "type" -#: models/notes.py:99 +#: models/notes.py:103 msgid "special note" msgstr "note spéciale" -#: models/notes.py:100 +#: models/notes.py:104 msgid "special notes" msgstr "notes spéciales" -#: models/notes.py:111 models/transactions.py:18 +#: models/notes.py:115 models/transactions.py:18 msgid "name" msgstr "nom" -#: models/notes.py:121 +#: models/notes.py:125 msgid "alias" msgstr "alias" -#: models/notes.py:122 +#: models/notes.py:126 msgid "aliases" msgstr "alias" -#: models/transactions.py:25 models/transactions.py:52 -#: models/transactions.py:55 -msgid "destination" -msgstr "destination" - #: models/transactions.py:28 models/transactions.py:62 msgid "amount" msgstr "montant" @@ -123,10 +131,6 @@ msgstr "modèle de transaction" msgid "transaction templates" msgstr "modèles de transaction" -#: models/transactions.py:46 -msgid "source" -msgstr "source" - #: models/transactions.py:59 msgid "quantity" msgstr "quantité" @@ -154,3 +158,11 @@ msgstr "transaction d'adhésion" #: models/transactions.py:89 msgid "membership transactions" msgstr "transactions d'adhésion" + +#: templates/note/transfer.html:7 +msgid "Home" +msgstr "Accueil" + +#: views.py:21 +msgid "Transfer money from your account to one or others" +msgstr "Transfert d'argent de ton compte vers un ou plusieurs autres" diff --git a/note/templates/note/transfer.html b/note/templates/note/transfer.html new file mode 100644 index 00000000..26183576 --- /dev/null +++ b/note/templates/note/transfer.html @@ -0,0 +1,10 @@ +{% extends "admin/base_site.html" %} + +{% load i18n %} + +{% block breadcrumbs %} + +{% endblock %} diff --git a/note/urls.py b/note/urls.py new file mode 100644 index 00000000..360e97ff --- /dev/null +++ b/note/urls.py @@ -0,0 +1,12 @@ +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from django.urls import path + +from . import views + +app_name = 'note' +urlpatterns = [ + path('transfer/', views.transfer, name='transfer'), +] diff --git a/note/views.py b/note/views.py new file mode 100644 index 00000000..a0a37082 --- /dev/null +++ b/note/views.py @@ -0,0 +1,23 @@ +# -*- mode: python; coding: utf-8 -*- +# Copyright (C) 2018-2019 by BDE ENS Paris-Saclay +# SPDX-License-Identifier: GPL-3.0-or-later + +from django.contrib.auth.decorators import login_required +from django.shortcuts import render +from django.utils.translation import gettext_lazy as _ + + +@login_required +def transfer(request): + """ + Show transfer page + + TODO: If user have sufficient rights, they can transfer from an other note + """ + return render( + request, + 'note/transfer.html', + { + 'title': _('Transfer money from your account to one or others') + } + ) diff --git a/note_kfet/urls.py b/note_kfet/urls.py index e78fee22..ea689e1f 100644 --- a/note_kfet/urls.py +++ b/note_kfet/urls.py @@ -7,8 +7,11 @@ from django.urls import path, include from django.views.generic import RedirectView urlpatterns = [ - # No app, so redirect to admin - path('', RedirectView.as_view(pattern_name='admin:index'), name='index'), + # Dev so redirect to something random + path('', RedirectView.as_view(pattern_name='note:transfer'), name='index'), + + # Include project routers + path('note/', include('note.urls')), # Include Django Contrib and Core routers # admin/login/ is redirected to the non-admin login page diff --git a/theme/locale/fr/LC_MESSAGES/django.po b/theme/locale/fr/LC_MESSAGES/django.po index 7b9adc7d..85838d8b 100644 --- a/theme/locale/fr/LC_MESSAGES/django.po +++ b/theme/locale/fr/LC_MESSAGES/django.po @@ -3,7 +3,7 @@ msgid "" msgstr "" "Project-Id-Version: PACKAGE VERSION\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2019-07-16 12:36+0200\n" +"POT-Creation-Date: 2019-07-17 13:33+0200\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -18,8 +18,8 @@ msgid "Welcome," msgstr "" #: templates/admin/base_site.html:27 -msgid "View site" -msgstr "Retour au site" +msgid "Transfer" +msgstr "Virement" #: templates/admin/base_site.html:32 templates/admin/base_site.html:51 msgid "View admin" diff --git a/theme/templates/admin/base_site.html b/theme/templates/admin/base_site.html index 3ef7f8a5..199ac4e6 100644 --- a/theme/templates/admin/base_site.html +++ b/theme/templates/admin/base_site.html @@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-3.0-or-later {% block branding %} - + {{ request.site.name }} @@ -23,9 +23,9 @@ SPDX-License-Identifier: GPL-3.0-or-later {% firstof user.get_short_name user.get_username %}. {% endblock %} {% block userlinks %} - {% if site_url %} - {% trans 'View site' %} / - {% endif %} + {# Link to our apps outside of admin #} + {% trans 'Transfer' %} / + {% if available_apps %} {# When in admin site, list all admin pages and documentation #}