mirror of
https://github.com/Nebucatnetzer/network_inventory.git
synced 2024-06-23 16:06:43 +02:00
correct get_objects to return 404 with wrong value
This commit is contained in:
parent
1123aeb259
commit
19ff961cfa
|
@ -59,11 +59,9 @@ def get_objects(model_name, user):
|
||||||
'softwares',
|
'softwares',
|
||||||
'users',
|
'users',
|
||||||
]
|
]
|
||||||
try:
|
for name in app_names:
|
||||||
for name in app_names:
|
app = apps.get_app_config(name)
|
||||||
app = apps.get_app_config(name)
|
if model_name in app.models:
|
||||||
if model_name in app.models:
|
model = app.models[model_name]
|
||||||
model = app.models[model_name]
|
return model.objects.filter(customer__in=customers)
|
||||||
return model.objects.filter(customer__in=customers)
|
raise Http404("Model ", model_name, " not found.")
|
||||||
except KeyError:
|
|
||||||
raise Http404("Model ", model_name, " not found.")
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user