mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Merge pull request #23 from SchrodingersGat/master
Fixing python errors
This commit is contained in:
commit
a9fc870a19
@ -1,7 +1,6 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
from django.core.exceptions import ObjectDoesNotExist
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
|
||||
|
||||
@ -99,7 +98,7 @@ class InvenTreeTree(models.Model):
|
||||
available = contents.get_all_objects_for_this_type()
|
||||
|
||||
# List of child IDs
|
||||
childs = getUniqueChildren()
|
||||
childs = self.getUniqueChildren()
|
||||
|
||||
acceptable = [None]
|
||||
|
||||
|
@ -11,7 +11,7 @@ if __name__ == "__main__":
|
||||
# issue is really that Django is missing to avoid masking other
|
||||
# exceptions on Python 2.
|
||||
try:
|
||||
import django
|
||||
import django # NOQA
|
||||
except ImportError:
|
||||
raise ImportError(
|
||||
"Couldn't import Django. Are you sure it's installed and "
|
||||
|
@ -4,14 +4,14 @@ from .models import PartCategory, Part, PartParameter, PartParameterTemplate, Ca
|
||||
|
||||
|
||||
class PartAdmin(admin.ModelAdmin):
|
||||
|
||||
|
||||
list_display = ('name', 'IPN', 'stock', 'category')
|
||||
|
||||
|
||||
class PartCategoryAdmin(admin.ModelAdmin):
|
||||
|
||||
|
||||
list_display = ('name', 'path', 'description')
|
||||
|
||||
|
||||
|
||||
class ParameterTemplateAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'units', 'format')
|
||||
@ -20,7 +20,7 @@ class ParameterTemplateAdmin(admin.ModelAdmin):
|
||||
class ParameterAdmin(admin.ModelAdmin):
|
||||
list_display = ('part', 'template', 'value')
|
||||
|
||||
|
||||
|
||||
admin.site.register(Part, PartAdmin)
|
||||
admin.site.register(PartCategory, PartCategoryAdmin)
|
||||
|
||||
|
@ -2,7 +2,6 @@ from __future__ import unicode_literals
|
||||
from django.utils.translation import ugettext as _
|
||||
from django.db import models
|
||||
from django.db.models import Sum
|
||||
from django.core.exceptions import ObjectDoesNotExist, ValidationError
|
||||
|
||||
from InvenTree.models import InvenTreeTree
|
||||
|
||||
@ -116,7 +115,7 @@ class PartParameterTemplate(models.Model):
|
||||
PARAM_BOOL: _("Bool")
|
||||
}
|
||||
|
||||
format = models.IntegerField(
|
||||
format = models.PositiveIntegerField(
|
||||
default=PARAM_NUMERIC,
|
||||
choices=PARAM_TYPE_CODES.items())
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
from django.test import TestCase
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -1,6 +1,4 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponse, Http404
|
||||
|
||||
from django.http import HttpResponse
|
||||
from rest_framework import generics
|
||||
|
||||
from .models import PartCategory, Part
|
||||
@ -11,9 +9,11 @@ from .serializers import PartCategoryBriefSerializer, PartCategoryDetailSerializ
|
||||
def part_index(request):
|
||||
return HttpResponse("Hello world. This is the parts page")
|
||||
|
||||
|
||||
def category_index(request):
|
||||
return HttpResponse("This is the category page")
|
||||
|
||||
|
||||
class PartDetail(generics.RetrieveAPIView):
|
||||
|
||||
queryset = Part.objects.all()
|
||||
|
@ -18,6 +18,7 @@ class ProjectPartAdmin(admin.ModelAdmin):
|
||||
class ProjectRunAdmin(admin.ModelAdmin):
|
||||
list_display = ('project', 'quantity', 'run_date')
|
||||
|
||||
|
||||
admin.site.register(ProjectCategory, ProjectCategoryAdmin)
|
||||
admin.site.register(Project, ProjectAdmin)
|
||||
admin.site.register(ProjectPart, ProjectPartAdmin)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from django.test import TestCase
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -1,4 +1,3 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
|
@ -10,5 +10,6 @@ class WarehouseAdmin(admin.ModelAdmin):
|
||||
class StockItemAdmin(admin.ModelAdmin):
|
||||
list_display = ('part', 'quantity', 'location', 'status', 'updated')
|
||||
|
||||
|
||||
admin.site.register(Warehouse, WarehouseAdmin)
|
||||
admin.site.register(StockItem, StockItemAdmin)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from django.test import TestCase
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -1,11 +1,10 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
from django.shortcuts import render
|
||||
|
||||
from .models import Warehouse, StockItem
|
||||
from .models import Warehouse
|
||||
|
||||
|
||||
def index(request):
|
||||
|
||||
|
||||
warehouses = Warehouse.objects.filter(parent=None)
|
||||
|
||||
|
||||
return render(request, 'stock/index.html', {'warehouses': warehouses})
|
||||
|
@ -6,6 +6,7 @@ from .models import Supplier, SupplierPart, Customer, Manufacturer
|
||||
class CompanyAdmin(admin.ModelAdmin):
|
||||
list_display = ('name', 'URL', 'contact')
|
||||
|
||||
|
||||
admin.site.register(Customer, CompanyAdmin)
|
||||
admin.site.register(Supplier, CompanyAdmin)
|
||||
admin.site.register(Manufacturer, CompanyAdmin)
|
||||
|
@ -77,7 +77,7 @@ class SupplierPriceBreak(models.Model):
|
||||
|
||||
def __str__(self):
|
||||
return "{mpn} - {cost}{currency} @ {quan}".format(
|
||||
mpn=part.MPN,
|
||||
mpn=self.part.MPN,
|
||||
cost=self.cost,
|
||||
currency=self.currency if self.currency else '',
|
||||
quan=self.quantity)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from django.test import TestCase
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -6,4 +6,5 @@ from .models import UniquePart
|
||||
class UniquePartAdmin(admin.ModelAdmin):
|
||||
list_display = ('part', 'revision', 'serial', 'status', 'creation_date')
|
||||
|
||||
|
||||
admin.site.register(UniquePart, UniquePartAdmin)
|
||||
|
@ -1,3 +1,3 @@
|
||||
from django.test import TestCase
|
||||
# from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
|
@ -1,4 +1,3 @@
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.http import HttpResponse
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user