2
0
mirror of https://github.com/inventree/InvenTree.git synced 2025-08-08 12:50:55 +00:00

Added ability to edit parts

- installed django_crispy_forms
- added EditPartForm in part/forms.py
- Vastly simplified parts views by using class views 
  (need to do this for the other apps too!)
This commit is contained in:
Oliver
2018-04-15 01:18:12 +10:00
parent 8578c8a1a7
commit 21e3f415c6
9 changed files with 96 additions and 62 deletions

31
InvenTree/part/forms.py Normal file
View File

@@ -0,0 +1,31 @@
from django import forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import Submit
from .models import Part
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',
]