PEP fixes

This commit is contained in:
Oliver Walters 2019-04-16 22:32:43 +10:00
parent 7eea9d1a20
commit 01bdf2f19b
6 changed files with 26 additions and 38 deletions

View File

@ -1,7 +1,7 @@
import io import io
import os
from wsgiref.util import FileWrapper from wsgiref.util import FileWrapper
from django.http import StreamingHttpResponse, HttpResponse from django.http import StreamingHttpResponse
def WrapWithQuotes(text): def WrapWithQuotes(text):

View File

@ -145,8 +145,6 @@ class AjaxCreateView(AjaxMixin, CreateView):
return super(CreateView, self).post(request, *args, **kwargs) return super(CreateView, self).post(request, *args, **kwargs)
class AjaxUpdateView(AjaxMixin, UpdateView): class AjaxUpdateView(AjaxMixin, UpdateView):
""" An 'AJAXified' UpdateView for updating an object in the db """ An 'AJAXified' UpdateView for updating an object in the db
@ -187,8 +185,6 @@ class AjaxUpdateView(AjaxMixin, UpdateView):
return super(UpdateView, self).post(request, *args, **kwargs) return super(UpdateView, self).post(request, *args, **kwargs)
class AjaxDeleteView(AjaxMixin, DeleteView): class AjaxDeleteView(AjaxMixin, DeleteView):
""" An 'AJAXified DeleteView for removing an object from the DB """ An 'AJAXified DeleteView for removing an object from the DB

View File

@ -5,7 +5,7 @@ from django_filters.rest_framework import DjangoFilterBackend
from rest_framework import filters from rest_framework import filters
from rest_framework import generics, permissions from rest_framework import generics, permissions
from django.conf.urls import url, include from django.conf.urls import url
from .models import Build from .models import Build
from .serializers import BuildSerializer from .serializers import BuildSerializer
@ -30,6 +30,7 @@ class BuildList(generics.ListAPIView):
'part', 'part',
] ]
build_api_urls = [ build_api_urls = [
url(r'^.*$', BuildList.as_view(), name='api-build-list') url(r'^.*$', BuildList.as_view(), name='api-build-list')
] ]

View File

@ -320,7 +320,6 @@ class Part(models.Model):
else: else:
return None return None
def export_bom_csv(self, **kwargs): def export_bom_csv(self, **kwargs):
# Construct header line # Construct header line
@ -336,26 +335,19 @@ class Part(models.Model):
return out return out
def export_bom_xls(self, **kwargs): def export_bom_xls(self, **kwargs):
return '' return ''
def export_bom_xml(self, **kwargs): def export_bom_xml(self, **kwargs):
return '' return ''
def export_bom_htm(self, **kwargs): def export_bom_htm(self, **kwargs):
return '' return ''
def export_bom_pdf(self, **kwargs): def export_bom_pdf(self, **kwargs):
return '' return ''
""" """
@property @property
def projects(self): def projects(self):

View File

@ -3,8 +3,7 @@ from __future__ import unicode_literals
from django.shortcuts import get_object_or_404 from django.shortcuts import get_object_or_404
from django.template.loader import render_to_string from django.urls import reverse_lazy
from django.urls import reverse_lazy, reverse
from django.views.generic import DetailView, ListView from django.views.generic import DetailView, ListView
from company.models import Company from company.models import Company
@ -19,10 +18,11 @@ from .forms import BomExportForm
from .forms import EditSupplierPartForm from .forms import EditSupplierPartForm
from InvenTree.views import AjaxMixin, AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView from InvenTree.views import AjaxView, AjaxCreateView, AjaxUpdateView, AjaxDeleteView
from InvenTree.helpers import DownloadFile from InvenTree.helpers import DownloadFile
class PartIndex(ListView): class PartIndex(ListView):
model = Part model = Part
template_name = 'part/category.html' template_name = 'part/category.html'
@ -129,7 +129,6 @@ class BomExport(AjaxView):
model = Part model = Part
ajax_form_title = 'Export BOM' ajax_form_title = 'Export BOM'
ajax_template_name = 'part/bom_export.html' ajax_template_name = 'part/bom_export.html'
#template_name = 'modal_form.html'
context_object_name = 'part' context_object_name = 'part'
form_class = BomExportForm form_class = BomExportForm
@ -139,6 +138,7 @@ class BomExport(AjaxView):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
form = self.form_class() form = self.form_class()
"""
part = self.get_object() part = self.get_object()
context = { context = {
@ -146,18 +146,17 @@ class BomExport(AjaxView):
} }
if request.is_ajax(): if request.is_ajax():
pass passs
"""
return self.renderJsonResponse(request, form, context=context) return self.renderJsonResponse(request, form)
def post(self, request, *args, **kwargs): def post(self, request, *args, **kwargs):
""" """
User has now submitted the BOM export data User has now submitted the BOM export data
""" """
part = self.get_object() # part = self.get_object()
print("POSTED")
return super(AjaxView, self).post(request, *args, **kwargs) return super(AjaxView, self).post(request, *args, **kwargs)

View File

@ -80,9 +80,9 @@ class StockItemEdit(AjaxUpdateView):
model = StockItem model = StockItem
form_class = EditStockItemForm form_class = EditStockItemForm
template_name = 'stock/item_edit.html' # template_name = 'stock/item_edit.html'
context_object_name = 'item' context_object_name = 'item'
#ajax_template_name = 'modal_form.html' ajax_template_name = 'modal_form.html'
ajax_form_title = 'Edit Stock Item' ajax_form_title = 'Edit Stock Item'