fix(config_management): Don't allow a config group to assign itself as its parent
!35 fixes #122
This commit is contained in:
@ -19,3 +19,16 @@ class ConfigGroupForm(CommonModelForm):
|
|||||||
'model_notes',
|
'model_notes',
|
||||||
'config',
|
'config',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def __init__(self, *args, **kwargs):
|
||||||
|
|
||||||
|
super().__init__(*args, **kwargs)
|
||||||
|
|
||||||
|
|
||||||
|
if 'parent' in kwargs['initial']:
|
||||||
|
|
||||||
|
self.fields['parent'].queryset = self.fields['parent'].queryset.filter(
|
||||||
|
).exclude(
|
||||||
|
id=int(kwargs['initial']['parent'])
|
||||||
|
)
|
||||||
|
Reference in New Issue
Block a user