mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-24 08:52:15 +00:00
Now asset_ids are going to be editable, removed that limitation from form
This commit is contained in:
@@ -9,10 +9,6 @@ class AssetForm(forms.ModelForm):
|
|||||||
model = models.Asset
|
model = models.Asset
|
||||||
fields = '__all__'
|
fields = '__all__'
|
||||||
|
|
||||||
def __init__(self, *args, **kwargs):
|
|
||||||
super(AssetForm, self).__init__(*args, **kwargs)
|
|
||||||
self.fields['asset_id'].disabled = True #You should not be able to change the asset ID, either in update or create
|
|
||||||
|
|
||||||
def clean_date_sold(self):
|
def clean_date_sold(self):
|
||||||
if self.cleaned_data["date_sold"] and self.cleaned_data["date_acquired"] > self.cleaned_data["date_sold"]:
|
if self.cleaned_data["date_sold"] and self.cleaned_data["date_acquired"] > self.cleaned_data["date_sold"]:
|
||||||
raise ValidationError("Cannot sell an item before it is acquired")
|
raise ValidationError("Cannot sell an item before it is acquired")
|
||||||
|
|||||||
Reference in New Issue
Block a user