Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
N
NoteKfet 2020
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
4
Issues
4
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BDE
NoteKfet 2020
Commits
51ad354e
Verified
Commit
51ad354e
authored
Jul 17, 2019
by
erdnaxe
🎇
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create view for transaction
parent
7bafbeb9
Pipeline
#1359
passed with stage
in 2 minutes and 25 seconds
Changes
9
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
105 additions
and
38 deletions
+105
-38
note/admin.py
note/admin.py
+1
-2
note/locale/fr/LC_MESSAGES/django.po
note/locale/fr/LC_MESSAGES/django.po
+16
-12
note/models/transactions.py
note/models/transactions.py
+3
-2
note/templates/note/transaction_form.html
note/templates/note/transaction_form.html
+55
-0
note/templates/note/transfer.html
note/templates/note/transfer.html
+0
-10
note/urls.py
note/urls.py
+1
-1
note/views.py
note/views.py
+16
-11
theme/templates/registration/logged_out.html
theme/templates/registration/logged_out.html
+5
-0
theme/templates/registration/login.html
theme/templates/registration/login.html
+8
-0
No files found.
note/admin.py
View file @
51ad354e
...
...
@@ -8,8 +8,7 @@ from polymorphic.admin import PolymorphicChildModelAdmin, \
PolymorphicChildModelFilter
,
PolymorphicParentModelAdmin
from
.models.notes
import
Alias
,
Note
,
NoteClub
,
NoteSpecial
,
NoteUser
from
.models.transactions
import
MembershipTransaction
,
Transaction
,
\
TransactionTemplate
from
.models.transactions
import
Transaction
,
TransactionTemplate
class
AliasInlines
(
admin
.
TabularInline
):
...
...
note/locale/fr/LC_MESSAGES/django.po
View file @
51ad354e
...
...
@@ -3,7 +3,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2019-07-17 13:
32
+0200\n"
"POT-Creation-Date: 2019-07-17 13:
48
+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
...
...
@@ -13,11 +13,11 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n > 1);\n"
#: admin.py:11
3
models/transactions.py:46
#: admin.py:11
2
models/transactions.py:46
msgid "source"
msgstr "source"
#: admin.py:12
1 admin.py:139
models/transactions.py:25
#: admin.py:12
0 admin.py:138
models/transactions.py:25
#: models/transactions.py:52
msgid "destination"
msgstr "destination"
...
...
@@ -136,33 +136,37 @@ msgid "quantity"
msgstr "quantité"
#: models/transactions.py:69
msgid "
descripti
on"
msgstr "
descripti
on"
msgid "
reas
on"
msgstr "
rais
on"
#: models/transactions.py:7
2
#: models/transactions.py:7
3
msgid "valid"
msgstr "valide"
#: models/transactions.py:7
6
#: models/transactions.py:7
7
msgid "transaction"
msgstr "transaction"
#: models/transactions.py:7
7
#: models/transactions.py:7
8
msgid "transactions"
msgstr "transactions"
#: models/transactions.py:8
8
#: models/transactions.py:8
9
msgid "membership transaction"
msgstr "transaction d'adhésion"
#: models/transactions.py:
89
#: models/transactions.py:
90
msgid "membership transactions"
msgstr "transactions d'adhésion"
#: templates/note/trans
fer.html:7
#: templates/note/trans
action_form.html:10
msgid "Home"
msgstr "Accueil"
#: views.py:21
#: templates/note/transaction_form.html:53
msgid "Transfer"
msgstr "Virement"
#: views.py:26
msgid "Transfer money from your account to one or others"
msgstr "Transfert d'argent de ton compte vers un ou plusieurs autres"
note/models/transactions.py
View file @
51ad354e
...
...
@@ -65,8 +65,9 @@ class Transaction(models.Model):
verbose_name
=
_
(
'type'
),
max_length
=
31
,
)
description
=
models
.
TextField
(
verbose_name
=
_
(
'description'
),
reason
=
models
.
CharField
(
verbose_name
=
_
(
'reason'
),
max_length
=
255
,
)
valid
=
models
.
NullBooleanField
(
verbose_name
=
_
(
'valid'
),
...
...
note/templates/note/transaction_form.html
0 → 100644
View file @
51ad354e
{% extends "admin/base_site.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n static %}
{% block breadcrumbs %}
<div
class=
"breadcrumbs"
>
<a
href=
"{% url 'index' %}"
>
{% trans 'Home' %}
</a>
{% if title %}
›
{{ title }}{% endif %}
</div>
{% endblock %}
{% block extrahead %}{{ block.super }}
{# Load Django Admin datetime widget #}
<script
type=
"text/javascript"
src=
"{% url 'admin:jsi18n' %}"
></script>
<script
type=
"text/javascript"
src=
"{% static 'admin/js/core.js' %}"
></script>
{{ form.media }}
{% endblock %}
{% block extrastyle %}{{ block.super }}
<link
rel=
"stylesheet"
type=
"text/css"
href=
"{% static "
admin
/
css
/
forms
.
css
"
%}"
>
{% endblock %}
{% block content %}
<form
method=
"post"
onsubmit=
"window.onbeforeunload=null"
>
{% csrf_token %}
{% if form.non_field_errors %}
<p
class=
"errornote"
>
{% for error in form.non_field_errors %}
{{ error }}
{% endfor %}
</p>
{% endif %}
<fieldset
class=
"module aligned"
>
{% for field in form %}
<div
class=
"form-row{% if field.errors %} errors{% endif %}"
>
{{ field.errors }}
<div>
{{ field.label_tag }}
{% if field.is_readonly %}
<div
class=
"readonly"
>
{{ field.contents }}
</div>
{% else %}
{{ field }}
{% endif %}
{% if field.field.help_text %}
<div
class=
"help"
>
{{ field.field.help_text|safe }}
</div>
{% endif %}
</div>
</div>
{% endfor %}
</fieldset>
<input
type=
"submit"
value=
"{% trans 'Transfer' %}"
>
</form>
{% endblock %}
\ No newline at end of file
note/templates/note/transfer.html
deleted
100644 → 0
View file @
7bafbeb9
{% extends "admin/base_site.html" %}
{% load i18n %}
{% block breadcrumbs %}
<div
class=
"breadcrumbs"
>
<a
href=
"{% url 'index' %}"
>
{% trans 'Home' %}
</a>
{% if title %}
›
{{ title }}{% endif %}
</div>
{% endblock %}
note/urls.py
View file @
51ad354e
...
...
@@ -8,5 +8,5 @@ from . import views
app_name
=
'note'
urlpatterns
=
[
path
(
'transfer/'
,
views
.
transfer
,
name
=
'transfer'
),
path
(
'transfer/'
,
views
.
TransactionCreate
.
as_view
()
,
name
=
'transfer'
),
]
note/views.py
View file @
51ad354e
...
...
@@ -2,22 +2,27 @@
# 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.contrib.auth.mixins
import
LoginRequiredMixin
from
django.utils.translation
import
gettext_lazy
as
_
from
django.views.generic.edit
import
CreateView
from
.models
import
Transaction
@
login_required
def
transfer
(
request
):
class
TransactionCreate
(
LoginRequiredMixin
,
CreateView
):
"""
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'
)
}
)
model
=
Transaction
fields
=
(
'destination'
,
'amount'
,
'reason'
)
def
get_context_data
(
self
,
**
kwargs
):
"""
Add some context variables in template such as page title
"""
context
=
super
()
.
get_context_data
(
**
kwargs
)
context
[
'title'
]
=
_
(
'Transfer money from your account '
'to one or others'
)
return
context
theme/templates/registration/logged_out.html
View file @
51ad354e
...
...
@@ -9,3 +9,8 @@ SPDX-License-Identifier: GPL-3.0-or-later
<a
href=
"{% url 'index' %}"
>
{% trans 'Home' %}
</a>
</div>
{% endblock %}
{% block content %}
<p>
{% trans "Thanks for spending some quality time with the Web site today." %}
</p>
<p><a
href=
"{% url 'index' %}"
>
{% trans 'Log in again' %}
</a></p>
{% endblock %}
\ No newline at end of file
theme/templates/registration/login.html
0 → 100644
View file @
51ad354e
{% extends "admin/login.html" %}
{% comment %}
SPDX-License-Identifier: GPL-2.0-or-later
{% endcomment %}
{% load i18n %}
{% block title %}{% trans "Log in" %}{% endblock %}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment