Skip to content

Commit 0bf7696

Browse files
committed
Fix: app label from static meta
1 parent bc9bf06 commit 0bf7696

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

django_mongoengine/forms/document_options.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,11 @@ def module_name(self):
114114
return self.model_name
115115

116116
def get_app_label(self):
117-
model_module = sys.modules[self.document.__module__]
118-
return model_module.__name__.split('.')[-2]
117+
if 'app_label' in self._meta:
118+
return self._meta['app_label']
119+
else:
120+
model_module = sys.modules[self.document.__module__]
121+
return model_module.__name__.split('.')[-2]
119122

120123
def get_verbose_name(self):
121124
"""

0 commit comments

Comments
 (0)