Merge pull request #149 from SchrodingersGat/get_absolute_url

Get absolute url
This commit is contained in:
Oliver authored and GitHub committed 2019-04-25 13:40:10 +10:00
commit 19001b98f7
20 files changed
+239 -73

No files matched your search

+7 -10
View File
@@ -74,9 +74,9 @@ class InvenTreeTree(models.Model):
@property
def children(self):
contents = ContentType.objects.get_for_model(type(self))
children = contents.get_all_objects_for_this_type(parent=self.id)
childs = contents.get_all_objects_for_this_type(parent=self.id)
return children
return childs
def getAcceptableParents(self):
""" Returns a list of acceptable parent items within this model
@@ -187,11 +187,8 @@ def FilterChildren(queryset, parent):
elif str2bool(parent, False):
return queryset.filter(parent=None)
else:
try:
parent_id = int(parent)
if parent_id == 0:
return queryset.filter(parent=None)
else:
return queryset.filter(parent=parent_id)
except:
return queryset
parent_id = int(parent)
if parent_id == 0:
return queryset.filter(parent=None)
else:
return queryset.filter(parent=parent_id)