Merge branch 'minors_fix' into 'master'

Minors fix

Closes #39

See merge request bde/nk20!52
This commit is contained in:
Pierre-antoine Comby 2020-03-09 20:46:20 +01:00
commit 62573a35df
6 changed files with 32 additions and 24 deletions

View File

@ -49,10 +49,10 @@ class UserCreateView(CreateView):
def form_valid(self, form): def form_valid(self, form):
profile_form = ProfileForm(self.request.POST) profile_form = ProfileForm(self.request.POST)
if form.is_valid() and profile_form.is_valid(): if form.is_valid() and profile_form.is_valid():
user = form.save() user = form.save(commit=False)
profile = profile_form.save(commit=False) user.profile = profile_form.save(commit=False)
profile.user = user user.save()
profile.save() user.profile.save()
return super().form_valid(form) return super().form_valid(form)

View File

@ -6,7 +6,8 @@ from django.db.models import F
from django_tables2.utils import A from django_tables2.utils import A
from .models.notes import Alias 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): class HistoryTable(tables.Table):
@ -16,6 +17,7 @@ class HistoryTable(tables.Table):
'table table-condensed table-striped table-hover' 'table table-condensed table-striped table-hover'
} }
model = Transaction model = Transaction
exclude = ("polymorphic_ctype", )
template_name = 'django_tables2/bootstrap4.html' template_name = 'django_tables2/bootstrap4.html'
sequence = ('...', 'total', 'valid') sequence = ('...', 'total', 'valid')
@ -27,6 +29,12 @@ class HistoryTable(tables.Table):
.order_by(('-' if is_descending else '') + 'total') .order_by(('-' if is_descending else '') + 'total')
return (queryset, True) 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 AliasTable(tables.Table):
class Meta: class Meta:

View File

@ -0,0 +1,11 @@
[
{
"model": "cas_server.servicepattern",
"pk": 1,
"fields": {
"pos": 1,
"pattern": ".*",
"name": "REPLACEME"
}
}
]

View File

@ -6,14 +6,5 @@
"domain": "localhost", "domain": "localhost",
"name": "La Note Kfet \ud83c\udf7b" "name": "La Note Kfet \ud83c\udf7b"
} }
},
{
"model": "cas_server.servicepattern",
"pk": 1,
"fields": {
"pos": 1,
"pattern": ".*",
"name": "REPLACEME"
}
} }
] ]

View File

@ -128,7 +128,6 @@ PASSWORD_HASHERS = [
AUTHENTICATION_BACKENDS = ( AUTHENTICATION_BACKENDS = (
'django.contrib.auth.backends.ModelBackend', # this is default 'django.contrib.auth.backends.ModelBackend', # this is default
'guardian.backends.ObjectPermissionBackend',
) )
REST_FRAMEWORK = { 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 # Internationalization
# https://docs.djangoproject.com/en/2.2/topics/i18n/ # https://docs.djangoproject.com/en/2.2/topics/i18n/

View File

@ -67,16 +67,19 @@ SPDX-License-Identifier: GPL-3.0-or-later
<div class="collapse navbar-collapse" id="navbarNavDropdown"> <div class="collapse navbar-collapse" id="navbarNavDropdown">
<ul class="navbar-nav"> <ul class="navbar-nav">
<li class="nav-item active"> <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>
<li class="nav-item active"> <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>
<li class="nav-item active"> <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>
<li class="nav-item active"> <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> </li>
</ul> </ul>
<ul class="navbar-nav ml-auto"> <ul class="navbar-nav ml-auto">