mirror of
https://github.com/netbox-community/netbox.git
synced 2025-07-20 19:19:22 -06:00
Catch AttributeError when generating ContentType labels
This commit is contained in:
parent
19cb575b90
commit
3ad7622bf0
@ -123,8 +123,11 @@ class ContentTypeChoiceMixin:
|
||||
super().__init__(queryset, *args, **kwargs)
|
||||
|
||||
def label_from_instance(self, obj):
|
||||
meta = obj.model_class()._meta
|
||||
return f'{meta.app_config.verbose_name} > {meta.verbose_name}'
|
||||
try:
|
||||
meta = obj.model_class()._meta
|
||||
return f'{meta.app_config.verbose_name} > {meta.verbose_name}'
|
||||
except AttributeError:
|
||||
return super().label_from_instance(obj)
|
||||
|
||||
|
||||
class ContentTypeChoiceField(ContentTypeChoiceMixin, forms.ModelChoiceField):
|
||||
|
Loading…
Reference in New Issue
Block a user