Repair Invoice model
This commit is contained in:
parent
f6027e9edd
commit
15bfdd9f96
8 changed files with 35 additions and 71 deletions
|
|
@ -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__'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue