mirror of
https://github.com/nottinghamtec/PyRIGS.git
synced 2026-01-25 17:32:16 +00:00
Started adding functionality for assets and cables forms to be dynamically swapped
This commit is contained in:
@@ -14,6 +14,11 @@ class AssetForm(forms.ModelForm):
|
|||||||
raise ValidationError("Cannot sell an item before it is acquired")
|
raise ValidationError("Cannot sell an item before it is acquired")
|
||||||
return self.cleaned_data["date_sold"]
|
return self.cleaned_data["date_sold"]
|
||||||
|
|
||||||
|
class CableForm(AssetForm):
|
||||||
|
class Meta:
|
||||||
|
model = models.Cable
|
||||||
|
fields = '__all__'
|
||||||
|
|
||||||
class SupplierForm(forms.ModelForm):
|
class SupplierForm(forms.ModelForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Supplier
|
model = models.Supplier
|
||||||
|
|||||||
@@ -13,6 +13,12 @@ from dateutil import parser
|
|||||||
import simplejson as json
|
import simplejson as json
|
||||||
from assets import models, forms
|
from assets import models, forms
|
||||||
|
|
||||||
|
class CableFormMixin:
|
||||||
|
def get_context_data(self, **kwargs):
|
||||||
|
context = super().get_context_data(**kwargs)
|
||||||
|
context["cableForm"] = forms.CableForm
|
||||||
|
return context
|
||||||
|
|
||||||
class AssetList(LoginRequiredMixin, generic.ListView):
|
class AssetList(LoginRequiredMixin, generic.ListView):
|
||||||
model = models.Asset
|
model = models.Asset
|
||||||
template_name = 'asset_list.html'
|
template_name = 'asset_list.html'
|
||||||
|
|||||||
Reference in New Issue
Block a user