added app namespaces to the context data

This commit is contained in:
Abhimanyu Saharan 2023-08-09 00:17:42 +05:30
parent 7a953fa5ef
commit b50ce17f57
2 changed files with 4 additions and 6 deletions

View File

@ -438,11 +438,10 @@ class DeviceViewSet(
app_ns = registry['model_features']['custom_fields'].keys() app_ns = registry['model_features']['custom_fields'].keys()
for app in app_ns: for app in app_ns:
context_data.setdefault(app, {})
models = apps.get_app_config(app).get_models() models = apps.get_app_config(app).get_models()
for model in models: for model in models:
context_data.update({ context_data[app][model.__name__] = model
model.__name__: model
})
return self.render_configtemplate(request, configtemplate, context_data) return self.render_configtemplate(request, configtemplate, context_data)

View File

@ -2084,11 +2084,10 @@ class DeviceRenderConfigView(generic.ObjectView):
app_ns = registry['model_features']['custom_fields'].keys() app_ns = registry['model_features']['custom_fields'].keys()
for app in app_ns: for app in app_ns:
context_data.setdefault(app, {})
models = apps.get_app_config(app).get_models() models = apps.get_app_config(app).get_models()
for model in models: for model in models:
context_data.update({ context_data[app][model.__name__] = model
model.__name__: model
})
# Render the config template # Render the config template
rendered_config = None rendered_config = None