mirror of
https://github.com/inventree/InvenTree.git
synced 2025-04-29 12:06:44 +00:00
Pepsi
This commit is contained in:
parent
c111aaf9b2
commit
14f60e1292
@ -7,4 +7,4 @@ before_install:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
# TODO - Only perform PEP8 checks on files that have been changed in this push / PR
|
# TODO - Only perform PEP8 checks on files that have been changed in this push / PR
|
||||||
- find . -name \*.py -exec pep8 --ignore=E402,W293 {} +
|
- find . -name \*.py -exec pep8 --ignore=E402,W293,E501 {} +
|
@ -4,6 +4,7 @@ from django.db import models
|
|||||||
from django.core.exceptions import ObjectDoesNotExist
|
from django.core.exceptions import ObjectDoesNotExist
|
||||||
from django.contrib.contenttypes.models import ContentType
|
from django.contrib.contenttypes.models import ContentType
|
||||||
|
|
||||||
|
|
||||||
class Company(models.Model):
|
class Company(models.Model):
|
||||||
""" Abstract model representing an external company
|
""" Abstract model representing an external company
|
||||||
"""
|
"""
|
||||||
@ -26,6 +27,7 @@ class Company(models.Model):
|
|||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name
|
||||||
|
|
||||||
|
|
||||||
class InvenTreeTree(models.Model):
|
class InvenTreeTree(models.Model):
|
||||||
""" Provides an abstracted self-referencing tree model for data categories.
|
""" Provides an abstracted self-referencing tree model for data categories.
|
||||||
- Each Category has one parent Category, which can be blank (for a top-level Category).
|
- Each Category has one parent Category, which can be blank (for a top-level Category).
|
||||||
@ -58,7 +60,7 @@ class InvenTreeTree(models.Model):
|
|||||||
|
|
||||||
# Some magic to get around the limitations of abstract models
|
# Some magic to get around the limitations of abstract models
|
||||||
contents = ContentType.objects.get_for_model(type(self))
|
contents = ContentType.objects.get_for_model(type(self))
|
||||||
children = contents.get_all_objects_for_this_type(parent = self.id)
|
children = contents.get_all_objects_for_this_type(parent=self.id)
|
||||||
|
|
||||||
for child in children:
|
for child in children:
|
||||||
child.getUniqueChildren(unique)
|
child.getUniqueChildren(unique)
|
||||||
@ -120,7 +122,8 @@ class InvenTreeTree(models.Model):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
if attrname == 'parent_id':
|
if attrname == 'parent_id':
|
||||||
# If current ID is None, continue (as this object is just being created)
|
# If current ID is None, continue
|
||||||
|
# - This object is just being created
|
||||||
if self.id is None:
|
if self.id is None:
|
||||||
pass
|
pass
|
||||||
# Parent cannot be set to same ID (this would cause looping)
|
# Parent cannot be set to same ID (this would cause looping)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user