mirror of
https://github.com/inventree/InvenTree.git
synced 2026-07-18 20:46:08 +00:00
Added PartCategory
- Parent can be null (top-level category) - Parent can be other PartCategory
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
from django.contrib import admin
|
||||
|
||||
from .models import PartCategory
|
||||
|
||||
admin.site.register(PartCategory)
|
||||
@@ -0,0 +1,7 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.apps import AppConfig
|
||||
|
||||
|
||||
class PartConfig(AppConfig):
|
||||
name = 'part'
|
||||
@@ -0,0 +1,14 @@
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import models
|
||||
|
||||
class PartCategory(models.Model):
|
||||
name = models.CharField(max_length=128)
|
||||
description = models.CharField(max_length=512)
|
||||
parent = models.ForeignKey('self', on_delete=models.CASCADE, blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
if self.parent:
|
||||
return str(self.parent) + "/" + self.name
|
||||
else:
|
||||
return self.name
|
||||
@@ -0,0 +1,3 @@
|
||||
from django.test import TestCase
|
||||
|
||||
# Create your tests here.
|
||||
@@ -0,0 +1,7 @@
|
||||
from django.conf.urls import url
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index, name='index')
|
||||
]
|
||||
@@ -0,0 +1,5 @@
|
||||
from django.shortcuts import render
|
||||
from django.http import HttpResponse
|
||||
|
||||
def index(request):
|
||||
return HttpResponse("Hello world. This is the parts page")
|
||||
Reference in New Issue
Block a user