From 28c23b613e94f2b7b4aa3f46b1f8eb6e4a17d542 Mon Sep 17 00:00:00 2001 From: JensDiemer Date: Sat, 17 Oct 2020 19:00:24 +0200 Subject: [PATCH] limit ItemModel.parent to "root"-Elements --- inventory/models/item.py | 1 + 1 file changed, 1 insertion(+) diff --git a/inventory/models/item.py b/inventory/models/item.py index 1d96748..55d2e5d 100644 --- a/inventory/models/item.py +++ b/inventory/models/item.py @@ -43,6 +43,7 @@ class ItemModel(BaseModel): ) parent = models.ForeignKey( 'self', + limit_choices_to={'parent_id': None}, on_delete=models.SET_NULL, blank=True, null=True, verbose_name=_('ItemModel.parent.verbose_name'),