Fixup import of component_views.py
This commit is contained in:
parent
173f0e3c91
commit
b3f8041f08
@ -1,24 +1,16 @@
|
||||
from django.shortcuts import render, redirect
|
||||
import uuid
|
||||
from django.shortcuts import redirect
|
||||
from django.urls import reverse
|
||||
from django.contrib.auth import logout, login
|
||||
from django.contrib.auth.forms import AuthenticationForm as AuthForm
|
||||
from django.contrib.auth.forms import PasswordChangeForm
|
||||
from django.contrib.auth import update_session_auth_hash
|
||||
import django.forms as forms
|
||||
from django.views.generic import TemplateView, DetailView
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
from ..models import Storage, Stock, Component, Distributor, Manufacturer, Package, ComponentParameter, DistributorNum
|
||||
from django.core.paginator import Paginator
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.db.models import Q
|
||||
from django.forms import formset_factory
|
||||
from django.db import IntegrityError
|
||||
from django.db.models import ProtectedError
|
||||
from ..models import Stock, Component, ComponentParameter, DistributorNum
|
||||
from ..forms import *
|
||||
from .component_import import import_components_from_csv
|
||||
from django.db.models import Q
|
||||
from django.db.models.functions import Lower
|
||||
from django.forms import formset_factory
|
||||
from django.http import HttpResponse
|
||||
import uuid
|
||||
from .generic_views import BaseTemplateMixin
|
||||
|
||||
|
||||
@ -76,7 +68,8 @@ class ComponentView(LoginRequiredMixin, BaseTemplateMixin, TemplateView):
|
||||
context['advanced_search_form'] = advanced_search
|
||||
context['advanced_search_param_formset'] = parameter_formset
|
||||
if advanced_search.is_valid():
|
||||
paginator_queryset = self.get_component_queryset_from_advanced_search(advanced_search.cleaned_data)
|
||||
paginator_queryset = self.get_component_queryset_from_advanced_search(
|
||||
advanced_search.cleaned_data)
|
||||
else:
|
||||
paginator_queryset = Component.objects.all()
|
||||
|
||||
@ -162,7 +155,6 @@ class ComponentView(LoginRequiredMixin, BaseTemplateMixin, TemplateView):
|
||||
else:
|
||||
return super().post(request, *args, **kwargs)
|
||||
|
||||
|
||||
class ComponentDetailView(LoginRequiredMixin, BaseTemplateMixin, DetailView):
|
||||
template_name = 'parts/components-detail.html'
|
||||
model = Component
|
||||
@ -178,8 +170,10 @@ class ComponentDetailView(LoginRequiredMixin, BaseTemplateMixin, DetailView):
|
||||
context['comp_form'] = ComponentForm(instance=self.object)
|
||||
context['new_distri_num_form'] = DistributorNumberCreateForm()
|
||||
context['new_param_form'] = ComponentParameterCreateForm()
|
||||
context['distri_nums'] = DistributorNum.objects.filter(component=self.object).order_by('distributor__name')
|
||||
context['parameters'] = ComponentParameter.objects.filter(component=self.object).order_by('parameter_type__parameter_name')
|
||||
context['distri_nums'] = DistributorNum.objects.filter(component=self.object).order_by(
|
||||
'distributor__name')
|
||||
context['parameters'] = ComponentParameter.objects.filter(component=self.object).order_by(
|
||||
'parameter_type__parameter_name')
|
||||
|
||||
return context
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user