mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
PEP fixes
This commit is contained in:
parent
2621c51a7e
commit
092215918c
@ -101,7 +101,7 @@ INSTALLED_APPS = [
|
|||||||
'crispy_forms', # Improved form rendering
|
'crispy_forms', # Improved form rendering
|
||||||
'import_export', # Import / export tables to file
|
'import_export', # Import / export tables to file
|
||||||
'django_cleanup', # Automatically delete orphaned MEDIA files
|
'django_cleanup', # Automatically delete orphaned MEDIA files
|
||||||
#'qr_code', # Generate QR codes
|
# 'qr_code', # Generate QR codes
|
||||||
'mptt', # Modified Preorder Tree Traversal
|
'mptt', # Modified Preorder Tree Traversal
|
||||||
'markdownx', # Markdown editing
|
'markdownx', # Markdown editing
|
||||||
'markdownify', # Markdown template rendering
|
'markdownify', # Markdown template rendering
|
||||||
|
@ -8,7 +8,8 @@ Passes URL lookup downstream to each app as required.
|
|||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
from django.contrib.auth import views as auth_views
|
from django.contrib.auth import views as auth_views
|
||||||
#from qr_code import urls as qr_code_urls
|
# TODO - Remove this line once a new QR solution has been implemented
|
||||||
|
# from qr_code import urls as qr_code_urls
|
||||||
|
|
||||||
from company.urls import company_urls
|
from company.urls import company_urls
|
||||||
from company.urls import supplier_part_urls
|
from company.urls import supplier_part_urls
|
||||||
@ -99,7 +100,8 @@ urlpatterns = [
|
|||||||
|
|
||||||
url(r'^admin/', admin.site.urls, name='inventree-admin'),
|
url(r'^admin/', admin.site.urls, name='inventree-admin'),
|
||||||
|
|
||||||
#url(r'^qr_code/', include(qr_code_urls, namespace='qr_code')),
|
# TODO - Remove this line!
|
||||||
|
# url(r'^qr_code/', include(qr_code_urls, namespace='qr_code')),
|
||||||
|
|
||||||
url(r'^index/', IndexView.as_view(), name='index'),
|
url(r'^index/', IndexView.as_view(), name='index'),
|
||||||
url(r'^search/', SearchView.as_view(), name='search'),
|
url(r'^search/', SearchView.as_view(), name='search'),
|
||||||
|
@ -6,10 +6,8 @@ Provides a JSON API for the Part app
|
|||||||
from __future__ import unicode_literals
|
from __future__ import unicode_literals
|
||||||
|
|
||||||
from django_filters.rest_framework import DjangoFilterBackend
|
from django_filters.rest_framework import DjangoFilterBackend
|
||||||
from django.conf import settings
|
|
||||||
|
|
||||||
from django.db.models import Q, F, Sum, Count
|
from django.db.models import Q, F, Count
|
||||||
from django.db.models.functions import Coalesce
|
|
||||||
|
|
||||||
from rest_framework import status
|
from rest_framework import status
|
||||||
from rest_framework.response import Response
|
from rest_framework.response import Response
|
||||||
@ -19,15 +17,11 @@ from rest_framework import generics, permissions
|
|||||||
from django.conf.urls import url, include
|
from django.conf.urls import url, include
|
||||||
from django.urls import reverse
|
from django.urls import reverse
|
||||||
|
|
||||||
import os
|
|
||||||
from decimal import Decimal
|
|
||||||
|
|
||||||
from .models import Part, PartCategory, BomItem, PartStar
|
from .models import Part, PartCategory, BomItem, PartStar
|
||||||
from .models import PartParameter, PartParameterTemplate
|
from .models import PartParameter, PartParameterTemplate
|
||||||
|
|
||||||
from . import serializers as part_serializers
|
from . import serializers as part_serializers
|
||||||
|
|
||||||
from InvenTree.status_codes import OrderStatus, StockStatus, BuildStatus
|
|
||||||
from InvenTree.views import TreeSerializer
|
from InvenTree.views import TreeSerializer
|
||||||
from InvenTree.helpers import str2bool, isNull
|
from InvenTree.helpers import str2bool, isNull
|
||||||
|
|
||||||
@ -125,6 +119,8 @@ class PartThumbs(generics.ListAPIView):
|
|||||||
# Get all Parts which have an associated image
|
# Get all Parts which have an associated image
|
||||||
queryset = Part.objects.all().exclude(image='')
|
queryset = Part.objects.all().exclude(image='')
|
||||||
|
|
||||||
|
# TODO - We should return the thumbnails here, not the full image!
|
||||||
|
|
||||||
# Return the most popular parts first
|
# Return the most popular parts first
|
||||||
data = queryset.values(
|
data = queryset.values(
|
||||||
'image',
|
'image',
|
||||||
@ -209,7 +205,6 @@ class PartList(generics.ListCreateAPIView):
|
|||||||
headers = self.get_success_headers(serializer.data)
|
headers = self.get_success_headers(serializer.data)
|
||||||
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
return Response(serializer.data, status=status.HTTP_201_CREATED, headers=headers)
|
||||||
|
|
||||||
|
|
||||||
def filter_queryset(self, queryset):
|
def filter_queryset(self, queryset):
|
||||||
"""
|
"""
|
||||||
Perform custom filtering of the queryset
|
Perform custom filtering of the queryset
|
||||||
|
@ -12,7 +12,7 @@ from .models import PartParameter, PartParameterTemplate
|
|||||||
|
|
||||||
from decimal import Decimal
|
from decimal import Decimal
|
||||||
|
|
||||||
from django.db.models import Q, F, Sum, Count
|
from django.db.models import Q, Sum
|
||||||
from django.db.models.functions import Coalesce
|
from django.db.models.functions import Coalesce
|
||||||
|
|
||||||
from InvenTree.status_codes import StockStatus, OrderStatus, BuildStatus
|
from InvenTree.status_codes import StockStatus, OrderStatus, BuildStatus
|
||||||
@ -99,7 +99,6 @@ class PartSerializer(InvenTreeModelSerializer):
|
|||||||
if category_detail is not True:
|
if category_detail is not True:
|
||||||
self.fields.pop('category_detail')
|
self.fields.pop('category_detail')
|
||||||
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def prefetch_queryset(queryset):
|
def prefetch_queryset(queryset):
|
||||||
"""
|
"""
|
||||||
|
Loading…
Reference in New Issue
Block a user