1
0
mirror of https://github.com/django/django.git synced 2025-10-24 22:26:08 +00:00

Took advantage of the new get_model API. Refs #21702.

This commit is contained in:
Aymeric Augustin
2014-01-26 12:57:08 +01:00
parent 3c47786cb9
commit f901b4d6c8
9 changed files with 29 additions and 40 deletions

View File

@@ -185,11 +185,11 @@ class ModelDetailView(BaseAdminDocsView):
def get_context_data(self, **kwargs):
# Get the model class.
try:
apps.get_app_config(self.kwargs['app_label'])
app_config = apps.get_app_config(self.kwargs['app_label'])
except LookupError:
raise Http404(_("App %(app_label)r not found") % self.kwargs)
try:
model = apps.get_model(self.kwargs['app_label'], self.kwargs['model_name'])
model = app_config.get_model(self.kwargs['model_name'])
except LookupError:
raise Http404(_("Model %(model_name)r not found in app %(app_label)r") % self.kwargs)