diff --git a/deposits/forms.py b/deposits/forms.py index 460fbfe7..12627278 100644 --- a/deposits/forms.py +++ b/deposits/forms.py @@ -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 diff --git a/deposits/models.py b/deposits/models.py index 81b3ee2d..7de37e67 100644 --- a/deposits/models.py +++ b/deposits/models.py @@ -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 diff --git a/deposits/templates/deposits/aff_deposit_item.html b/deposits/templates/deposits/aff_deposit_item.html index 702b340a..0c0b1c06 100644 --- a/deposits/templates/deposits/aff_deposit_item.html +++ b/deposits/templates/deposits/aff_deposit_item.html @@ -36,7 +36,7 @@ with this program; if not, write to the Free Software Foundation, Inc., {% for item in item_list %}