Display default today date in new refund page

This commit is contained in:
Gabriel Augendre 2018-01-22 07:49:17 +01:00
parent 5f91aa9879
commit 81c954e662

View file

@ -1,3 +1,5 @@
import datetime
from bootstrap3_datetime.widgets import DateTimePicker from bootstrap3_datetime.widgets import DateTimePicker
from django import forms from django import forms
from django.db.models import Q from django.db.models import Q
@ -19,6 +21,7 @@ class RefundForm(forms.ModelForm):
.objects\ .objects\
.filter(Q(refund=None) | Q(refund=self.instance))\ .filter(Q(refund=None) | Q(refund=self.instance))\
.order_by('-date') .order_by('-date')
self.fields['date'].initial = datetime.date.today()
def save(self, *args, **kwargs): def save(self, *args, **kwargs):
# Save the refund # Save the refund