mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
14 lines
436 B
Python
14 lines
436 B
Python
|
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
|