1
0
mirror of https://gitlab.crans.org/bde/nk20 synced 2025-06-21 01:48:21 +02:00

Repair Invoice model

This commit is contained in:
Yohann D'ANELLO
2020-03-22 15:24:54 +01:00
parent f6027e9edd
commit 15bfdd9f96
8 changed files with 35 additions and 71 deletions

View File

@ -1,6 +1,8 @@
# Copyright (C) 2018-2020 by BDE ENS Paris-Saclay
# SPDX-License-Identifier: GPL-3.0-or-later
import datetime
from crispy_forms.helper import FormHelper
from django import forms
@ -8,6 +10,14 @@ from .models import Invoice, Product
class InvoiceForm(forms.ModelForm):
date = forms.DateField(
initial=datetime.date.today,
widget=forms.TextInput(attrs={'type': 'date'})
)
def clean_date(self):
self.instance.date = self.data.get("date")
class Meta:
model = Invoice
fields = '__all__'