diff --git a/apps/member/views.py b/apps/member/views.py index 88bd267848a7474984cef0b5012c6844c055c2aa..21c8de5f861144eb30169b6c8aeb15586c699ad9 100644 --- a/apps/member/views.py +++ b/apps/member/views.py @@ -49,10 +49,10 @@ class UserCreateView(CreateView): def form_valid(self, form): profile_form = ProfileForm(self.request.POST) if form.is_valid() and profile_form.is_valid(): - user = form.save() - profile = profile_form.save(commit=False) - profile.user = user - profile.save() + user = form.save(commit=False) + user.profile = profile_form.save(commit=False) + user.save() + user.profile.save() return super().form_valid(form) diff --git a/apps/note/tables.py b/apps/note/tables.py index 9a2dce4596dbabe406acd3c531a310a20628723a..e85fcbaed7598acf0914a4588138f93cfddefb86 100644 --- a/apps/note/tables.py +++ b/apps/note/tables.py @@ -6,7 +6,8 @@ from django.db.models import F from django_tables2.utils import A from .models.notes import Alias -from .models.transactions import Transaction +from .models.transactions import Transaction, TransactionTemplate +from .templatetags.pretty_money import pretty_money class HistoryTable(tables.Table): @@ -16,6 +17,7 @@ class HistoryTable(tables.Table): 'table table-condensed table-striped table-hover' } model = Transaction + exclude = ("polymorphic_ctype", ) template_name = 'django_tables2/bootstrap4.html' sequence = ('...', 'total', 'valid') @@ -27,6 +29,12 @@ class HistoryTable(tables.Table): .order_by(('-' if is_descending else '') + 'total') return (queryset, True) + def render_amount(self, value): + return pretty_money(value) + + def render_total(self, value): + return pretty_money(value) + class AliasTable(tables.Table): class Meta: diff --git a/note_kfet/fixtures/cas.json b/note_kfet/fixtures/cas.json new file mode 100644 index 0000000000000000000000000000000000000000..c3109d19d402cb277797dd5a1fbaf1b34bf75cbc --- /dev/null +++ b/note_kfet/fixtures/cas.json @@ -0,0 +1,11 @@ +[ + { + "model": "cas_server.servicepattern", + "pk": 1, + "fields": { + "pos": 1, + "pattern": ".*", + "name": "REPLACEME" + } + } +] diff --git a/note_kfet/fixtures/initial.json b/note_kfet/fixtures/initial.json index 1b7799807cb835ced23a44adf79ee72dfdeae398..72e472340120c572d90d5306b1942b32b48d71e9 100644 --- a/note_kfet/fixtures/initial.json +++ b/note_kfet/fixtures/initial.json @@ -6,14 +6,5 @@ "domain": "localhost", "name": "La Note Kfet \ud83c\udf7b" } - }, - { - "model": "cas_server.servicepattern", - "pk": 1, - "fields": { - "pos": 1, - "pattern": ".*", - "name": "REPLACEME" - } } -] \ No newline at end of file +] diff --git a/note_kfet/settings/base.py b/note_kfet/settings/base.py index a1dbb92923a75dadf6ba5716fec27f140f658031..4fe12fbf2df1323b9dddd7c4acd88752654fc2b3 100644 --- a/note_kfet/settings/base.py +++ b/note_kfet/settings/base.py @@ -128,7 +128,6 @@ PASSWORD_HASHERS = [ AUTHENTICATION_BACKENDS = ( 'django.contrib.auth.backends.ModelBackend', # this is default - 'guardian.backends.ObjectPermissionBackend', ) REST_FRAMEWORK = { @@ -143,10 +142,6 @@ REST_FRAMEWORK = { ] } -ANONYMOUS_USER_NAME = None # Disable guardian anonymous user - -GUARDIAN_GET_CONTENT_TYPE = 'polymorphic.contrib.guardian.get_polymorphic_base_content_type' - # Internationalization # https://docs.djangoproject.com/en/2.2/topics/i18n/ diff --git a/templates/base.html b/templates/base.html index 6814bedfba9b3783255ffe7df3fd3b1a826889db..887bc970187199df60a62a9808891f75af04c6dd 100644 --- a/templates/base.html +++ b/templates/base.html @@ -67,16 +67,19 @@ SPDX-License-Identifier: GPL-3.0-or-later <div class="collapse navbar-collapse" id="navbarNavDropdown"> <ul class="navbar-nav"> <li class="nav-item active"> - <a class="nav-link" href="{% url 'note:consos' %}"><i class="fa fa-coffee"></i> Consos</a> + <a class="nav-link" href="{% url 'note:consos' %}"><i class="fa fa-coffee"></i> {% trans 'Consumptions' %}</a> </li> <li class="nav-item active"> - <a class="nav-link" href="{% url 'member:club_list' %}"><i class="fa fa-users"></i> Clubs</a> + <a class="nav-link" href="{% url 'member:club_list' %}"><i class="fa fa-users"></i> {% trans 'Clubs' %}</a> </li> <li class="nav-item active"> - <a class="nav-link" href="#"><i class="fa fa-calendar"></i> Activités</a> + <a class="nav-link" href="#"><i class="fa fa-calendar"></i> {% trans 'Activities' %}</a> </li> <li class="nav-item active"> - <a class="nav-link" href="{% url 'note:template_list' %}"><i class="fa fa-coffee"></i> Bouton</a> + <a class="nav-link" href="{% url 'note:template_list' %}"><i class="fa fa-coffee"></i> {% trans 'Button' %}</a> + </li> + <li class="nav-item active"> + <a class="nav-link" href="{% url 'note:transfer' %}"><i class="fa fa-exchange"></i>{% trans 'Transfer' %} </a> </li> </ul> <ul class="navbar-nav ml-auto">