mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
9f4b8b473b
@ -16,8 +16,7 @@ class PartCategory(InvenTreeTree):
|
||||
|
||||
@property
|
||||
def parts(self):
|
||||
parts_list = self.part_set.all()
|
||||
return parts_list
|
||||
return self.part_set.all()
|
||||
|
||||
|
||||
class Part(models.Model):
|
||||
|
@ -3,15 +3,15 @@ from django.conf.urls import url
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
# Display part detail
|
||||
# Single part detail
|
||||
url(r'^(?P<pk>[0-9]+)/$', views.PartDetail.as_view()),
|
||||
|
||||
# Display a single part category
|
||||
# Part category detail
|
||||
url(r'^category/(?P<pk>[0-9]+)/$', views.PartCategoryDetail.as_view()),
|
||||
|
||||
# Display a list of top-level categories
|
||||
# List of top-level categories
|
||||
url(r'^category/$', views.PartCategoryList.as_view()),
|
||||
|
||||
# Display list of all parts
|
||||
# List of all parts
|
||||
url(r'^$', views.PartList.as_view())
|
||||
]
|
||||
|
@ -1,4 +1,3 @@
|
||||
from django.http import HttpResponse
|
||||
from rest_framework import generics
|
||||
|
||||
from .models import PartCategory, Part
|
||||
@ -6,14 +5,6 @@ from .serializers import PartBriefSerializer, PartDetailSerializer
|
||||
from .serializers import PartCategoryBriefSerializer, PartCategoryDetailSerializer
|
||||
|
||||
|
||||
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()
|
||||
|
Loading…
Reference in New Issue
Block a user