mirror of
https://gitlab2.federez.net/re2o/re2o
synced 2024-11-27 23:22:25 +00:00
fix: Minor fixes to deposit app
This commit is contained in:
parent
824d882b81
commit
32b126d839
6 changed files with 8 additions and 6 deletions
|
@ -26,14 +26,13 @@ from django import forms
|
|||
from django.forms import Form, ModelForm
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from re2o.field_permissions import FieldPermissionFormMixin
|
||||
from re2o.mixins import FormRevMixin
|
||||
from re2o.widgets import AutocompleteModelWidget
|
||||
|
||||
from .models import Deposit, DepositItem
|
||||
|
||||
|
||||
class DepositForm(FieldPermissionFormMixin, FormRevMixin, ModelForm):
|
||||
class DepositForm(FormRevMixin, ModelForm):
|
||||
"""
|
||||
Form used to manage and create an invoice and its fields.
|
||||
"""
|
||||
|
@ -45,6 +44,8 @@ class DepositForm(FieldPermissionFormMixin, FormRevMixin, ModelForm):
|
|||
self.fields["user"].label = _("Member")
|
||||
self.fields["user"].empty_label = _("Select the proprietary member")
|
||||
self.fields["returned"].label = _("Deposit returned")
|
||||
else:
|
||||
self.fields = {"item": self.fields["item"]}
|
||||
|
||||
class Meta:
|
||||
model = Deposit
|
||||
|
|
|
@ -50,7 +50,7 @@ class Deposit(RevMixin, AclMixin, models.Model):
|
|||
item = models.ForeignKey("DepositItem", on_delete=models.PROTECT)
|
||||
date = models.DateTimeField(auto_now_add=True, verbose_name=_("date"))
|
||||
returned = models.BooleanField(default=False, verbose_name=_("returned"))
|
||||
return_date = models.DateTimeField(default=None, verbose_name=_("return date"))
|
||||
return_date = models.DateTimeField(default=None, null=True, verbose_name=_("return date"))
|
||||
|
||||
class Meta:
|
||||
abstract = False
|
||||
|
|
|
@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
{% for item in item_list %}
|
||||
<tr>
|
||||
<td>{{ item.name }}</td>
|
||||
<td>{{ item.deposit_amount }}</td>
|
||||
<td>{{ item.deposit_amount }} €</td>
|
||||
<td class="text-right">
|
||||
{% can_edit item %}
|
||||
{% include 'buttons/edit.html' with href='deposits:edit-deposit-item' id=item.id %}
|
||||
|
|
|
@ -32,7 +32,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<div id="deposits" class="panel-collapse collapse">
|
||||
<div class="panel-body">
|
||||
{% can_create Deposit %}
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'deposits:new-deposit' %}">
|
||||
<a class="btn btn-primary btn-sm" role="button" href="{% url 'deposits:new-deposit' users.id %}">
|
||||
<i class="fa fa-balance-scale"></i> {% trans "Add a deposit" %}
|
||||
</a>
|
||||
{% acl_end %}
|
||||
|
|
|
@ -39,5 +39,5 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
<i class="fa fa-trash"></i> {% trans "Delete one or several deposit items" %}
|
||||
</a>
|
||||
{% acl_end %}
|
||||
{% include 'deposits/aff_deposit_item.html' with item_list=item_list %}
|
||||
{% include 'deposits/aff_deposit_item.html' with item_list=item_list %}
|
||||
{% endblock %}
|
||||
|
|
|
@ -228,6 +228,7 @@ def aff_profil(request, user):
|
|||
|
||||
deposits = re2o_paginator(request, deposits_list, pagination_number)
|
||||
context = {
|
||||
"user": user,
|
||||
"deposits_list": deposits,
|
||||
}
|
||||
return render_to_string(
|
||||
|
|
Loading…
Reference in a new issue