mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
ab4b91cd46
- Supplier list view - Supplier detail view /supplier/<pk>/ - Added create / edit / delete views for supplier - Supplier part detail at /supplier/part/<pk> - Added create / edit / delete views for supplier part - Added some templates to make things easier
53 lines
1.3 KiB
Python
53 lines
1.3 KiB
Python
from django import forms
|
|
from crispy_forms.helper import FormHelper
|
|
from crispy_forms.layout import Submit
|
|
|
|
from .models import Part, PartCategory
|
|
|
|
|
|
class EditPartForm(forms.ModelForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(EditPartForm, self).__init__(*args, **kwargs)
|
|
self.helper = FormHelper()
|
|
|
|
self.helper.form_id = 'id-edit-part-form'
|
|
#self.helper.form_class = 'blueForms'
|
|
self.helper.form_method = 'post'
|
|
#self.helper.form_action = 'submit'
|
|
|
|
self.helper.add_input(Submit('submit', 'Submit'))
|
|
|
|
class Meta:
|
|
model = Part
|
|
fields = [
|
|
'category',
|
|
'name',
|
|
'description',
|
|
'IPN',
|
|
'URL',
|
|
'minimum_stock',
|
|
'trackable',
|
|
]
|
|
|
|
|
|
class EditCategoryForm(forms.ModelForm):
|
|
|
|
def __init__(self, *args, **kwargs):
|
|
super(EditCategoryForm, self).__init__(*args, **kwargs)
|
|
self.helper = FormHelper()
|
|
|
|
self.helper.form_id = 'id-edit-part-form'
|
|
#self.helper.form_class = 'blueForms'
|
|
self.helper.form_method = 'post'
|
|
#self.helper.form_action = 'submit'
|
|
|
|
self.helper.add_input(Submit('submit', 'Submit'))
|
|
|
|
class Meta:
|
|
model = PartCategory
|
|
fields = [
|
|
'parent',
|
|
'name',
|
|
'description'
|
|
] |