Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
NoteKfet 2020
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
19
Issues
19
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
BDE
NoteKfet 2020
Commits
55884f01
Commit
55884f01
authored
Aug 14, 2019
by
Pierre-antoine Comby
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'transaction_history' into 'master'
Transaction history See merge request
bde/nk20!4
parents
2a2e78f8
66b70e69
Pipeline
#1444
passed with stage
in 2 minutes and 55 seconds
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
26 additions
and
3 deletions
+26
-3
apps/member/views.py
apps/member/views.py
+10
-1
apps/note/templatetags/__init__.py
apps/note/templatetags/__init__.py
+0
-0
apps/note/templatetags/pretty_money.py
apps/note/templatetags/pretty_money.py
+12
-0
templates/member/profile_detail.html
templates/member/profile_detail.html
+4
-2
No files found.
apps/member/views.py
View file @
55884f01
...
...
@@ -9,9 +9,11 @@ from django.views.generic import CreateView, ListView, DetailView
from
django.http
import
HttpResponseRedirect
from
django.contrib.auth.forms
import
UserCreationForm
from
django.urls
import
reverse_lazy
from
django.db.models
import
Q
from
.models
import
Profile
,
Club
from
.forms
import
ProfileForm
,
ClubForm
from
note.models.transactions
import
Transaction
class
UserCreateView
(
CreateView
):
"""
...
...
@@ -39,10 +41,17 @@ class UserCreateView(CreateView):
return
super
().
form_valid
(
form
)
class
UserDetailView
(
LoginRequiredMixin
,
DetailView
):
model
=
Profile
def
get_context_data
(
slef
,
**
kwargs
):
context
=
super
().
get_context_data
(
**
kwargs
)
user
=
context
[
'object'
].
user
.
note
user_transactions
=
\
Transaction
.
objects
.
all
().
filter
(
Q
(
source
=
user
)
|
Q
(
destination
=
user
))
context
[
'history_list'
]
=
user_transactions
return
context
class
ClubCreateView
(
LoginRequiredMixin
,
CreateView
):
"""
...
...
apps/note/templatetags/__init__.py
0 → 100644
View file @
55884f01
apps/note/templatetags/pretty_money.py
0 → 100644
View file @
55884f01
from
django
import
template
def
pretty_money
(
value
):
if
value
%
100
==
0
:
return
str
(
value
//
100
)
+
'€'
else
:
return
str
(
value
//
100
)
+
'€ '
+
str
(
value
%
100
)
register
=
template
.
Library
()
register
.
filter
(
'pretty_money'
,
pretty_money
)
templates/member/profile_detail.html
View file @
55884f01
{% extends "base.html" %}
{% load i18n static %}
{% load i18n static
pretty_money django_tables2
%}
{% block content %}
<h3>
Compte n° {{ object.pk }}
</h3>
...
...
@@ -20,8 +20,10 @@
<dt
class=
"col-6 col-md-3"
>
{% trans 'address'|capfirst %}
</dt>
<dd
class=
"col-6 col-md-3"
>
{{ object.address }}
</dd>
<dt
class=
"col-6 col-md-3"
>
{% trans 'balance'|capfirst %}
</dt>
<dd
class=
"col-6 col-md-3"
>
{{ object.user.note.balance }}
</dd>
<dd
class=
"col-6 col-md-3"
>
{{ object.user.note.balance
| pretty_money
}}
</dd>
</dl>
<a
href=
"{% url "
password_change
"
%}"
>
{% trans 'Change password' %}
</a>
{% render_table history_list %}
{% endblock %}
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