mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Cleanup for part.views
This commit is contained in:
parent
63114a29f1
commit
343850c4f0
@ -17,14 +17,7 @@ from .models import PartCategory, Part, PartAttachment
|
||||
from .models import BomItem
|
||||
from .models import SupplierPart
|
||||
|
||||
from .forms import PartImageForm
|
||||
from .forms import EditPartForm
|
||||
from .forms import EditPartAttachmentForm
|
||||
from .forms import EditCategoryForm
|
||||
from .forms import EditBomItemForm
|
||||
from .forms import BomExportForm
|
||||
|
||||
from .forms import EditSupplierPartForm
|
||||
from . import forms as part_forms
|
||||
|
||||
from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
|
||||
from InvenTree.views import QRCodeView
|
||||
@ -60,7 +53,7 @@ class PartAttachmentCreate(AjaxCreateView):
|
||||
- The view only makes sense if a Part object is passed to it
|
||||
"""
|
||||
model = PartAttachment
|
||||
form_class = EditPartAttachmentForm
|
||||
form_class = part_forms.EditPartAttachmentForm
|
||||
ajax_form_title = "Add part attachment"
|
||||
ajax_template_name = "modal_form.html"
|
||||
|
||||
@ -99,7 +92,7 @@ class PartAttachmentCreate(AjaxCreateView):
|
||||
class PartAttachmentEdit(AjaxUpdateView):
|
||||
""" View for editing a PartAttachment object """
|
||||
model = PartAttachment
|
||||
form_class = EditPartAttachmentForm
|
||||
form_class = part_forms.EditPartAttachmentForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit attachment'
|
||||
|
||||
@ -139,7 +132,7 @@ class PartCreate(AjaxCreateView):
|
||||
- Copy an existing Part
|
||||
"""
|
||||
model = Part
|
||||
form_class = EditPartForm
|
||||
form_class = part_forms.EditPartForm
|
||||
|
||||
ajax_form_title = 'Create new part'
|
||||
ajax_template_name = 'modal_form.html'
|
||||
@ -260,7 +253,7 @@ class PartImage(AjaxUpdateView):
|
||||
model = Part
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Upload Part Image'
|
||||
form_class = PartImageForm
|
||||
form_class = part_forms.PartImageForm
|
||||
|
||||
def get_data(self):
|
||||
return {
|
||||
@ -272,7 +265,7 @@ class PartEdit(AjaxUpdateView):
|
||||
""" View for editing Part object """
|
||||
|
||||
model = Part
|
||||
form_class = EditPartForm
|
||||
form_class = part_forms.EditPartForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit Part Properties'
|
||||
context_object_name = 'part'
|
||||
@ -298,7 +291,7 @@ class BomExport(AjaxView):
|
||||
ajax_form_title = 'Export BOM'
|
||||
ajax_template_name = 'part/bom_export.html'
|
||||
context_object_name = 'part'
|
||||
form_class = BomExportForm
|
||||
form_class = part_forms.BomExportForm
|
||||
|
||||
def get_object(self):
|
||||
return get_object_or_404(Part, pk=self.kwargs['pk'])
|
||||
@ -396,7 +389,7 @@ class CategoryDetail(DetailView):
|
||||
class CategoryEdit(AjaxUpdateView):
|
||||
""" Update view to edit a PartCategory """
|
||||
model = PartCategory
|
||||
form_class = EditCategoryForm
|
||||
form_class = part_forms.EditCategoryForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit Part Category'
|
||||
|
||||
@ -449,7 +442,7 @@ class CategoryCreate(AjaxCreateView):
|
||||
ajax_form_action = reverse_lazy('category-create')
|
||||
ajax_form_title = 'Create new part category'
|
||||
ajax_template_name = 'modal_form.html'
|
||||
form_class = EditCategoryForm
|
||||
form_class = part_forms.EditCategoryForm
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
""" Add extra context data to template.
|
||||
@ -496,7 +489,7 @@ class BomItemDetail(DetailView):
|
||||
class BomItemCreate(AjaxCreateView):
|
||||
""" Create view for making a new BomItem object """
|
||||
model = BomItem
|
||||
form_class = EditBomItemForm
|
||||
form_class = part_forms.EditBomItemForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Create BOM item'
|
||||
|
||||
@ -554,7 +547,7 @@ class BomItemEdit(AjaxUpdateView):
|
||||
""" Update view for editing BomItem """
|
||||
|
||||
model = BomItem
|
||||
form_class = EditBomItemForm
|
||||
form_class = part_forms.EditBomItemForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit BOM item'
|
||||
|
||||
@ -580,7 +573,7 @@ class SupplierPartEdit(AjaxUpdateView):
|
||||
|
||||
model = SupplierPart
|
||||
context_object_name = 'part'
|
||||
form_class = EditSupplierPartForm
|
||||
form_class = part_forms.EditSupplierPartForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Edit Supplier Part'
|
||||
|
||||
@ -589,7 +582,7 @@ class SupplierPartCreate(AjaxCreateView):
|
||||
""" Create view for making new SupplierPart """
|
||||
|
||||
model = SupplierPart
|
||||
form_class = EditSupplierPartForm
|
||||
form_class = part_forms.EditSupplierPartForm
|
||||
ajax_template_name = 'modal_form.html'
|
||||
ajax_form_title = 'Create new Supplier Part'
|
||||
context_object_name = 'part'
|
||||
|
Loading…
Reference in New Issue
Block a user