Fixed bug editing expenses or income that removes the date
This commit is contained in:
parent
8d64673114
commit
13638e74a0
@ -13,6 +13,7 @@ class ExpenseForm(forms.ModelForm):
|
|||||||
self.fields['category'].queryset = Category.objects.filter(owner=user)
|
self.fields['category'].queryset = Category.objects.filter(owner=user)
|
||||||
self.fields['tags'].queryset = Tag.objects.filter(owner=user)
|
self.fields['tags'].queryset = Tag.objects.filter(owner=user)
|
||||||
self.fields['account'].queryset = Account.objects.filter(owner=user, active=True)
|
self.fields['account'].queryset = Account.objects.filter(owner=user, active=True)
|
||||||
|
self.fields['date'].input_formats = ['%Y-%m-%d']
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Expense
|
model = Expense
|
||||||
@ -25,7 +26,9 @@ class ExpenseForm(forms.ModelForm):
|
|||||||
'tags',
|
'tags',
|
||||||
]
|
]
|
||||||
widgets = {
|
widgets = {
|
||||||
'date': forms.DateInput(attrs={'type': 'date'}),
|
'date': forms.DateInput(
|
||||||
|
format='%Y-%m-%d',
|
||||||
|
attrs={'type': 'date'}),
|
||||||
'widget': forms.CheckboxSelectMultiple(),
|
'widget': forms.CheckboxSelectMultiple(),
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -46,7 +49,9 @@ class IncomeForm(forms.ModelForm):
|
|||||||
model = Income
|
model = Income
|
||||||
fields = ['account', 'name', 'amount', 'date']
|
fields = ['account', 'name', 'amount', 'date']
|
||||||
widgets = {
|
widgets = {
|
||||||
'date': forms.DateInput(attrs={'type': 'date'})
|
'date': forms.DateInput(
|
||||||
|
format='%Y-%m-%d',
|
||||||
|
attrs={'type': 'date'})
|
||||||
}
|
}
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
def __init__(self, *args, **kwargs):
|
||||||
@ -59,7 +64,9 @@ class IncomeForm(forms.ModelForm):
|
|||||||
|
|
||||||
class FuelEntryForm(forms.Form):
|
class FuelEntryForm(forms.Form):
|
||||||
# Expense fields
|
# Expense fields
|
||||||
date = forms.DateField(widget=forms.DateInput(attrs={'type': 'date'}))
|
date = forms.DateField(widget=forms.DateInput(
|
||||||
|
format='%Y-%m-%d',
|
||||||
|
attrs={'type': 'date'}))
|
||||||
amount = forms.DecimalField(max_digits=10, decimal_places=2)
|
amount = forms.DecimalField(max_digits=10, decimal_places=2)
|
||||||
account = forms.ModelChoiceField(queryset=None)
|
account = forms.ModelChoiceField(queryset=None)
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user