diff comments/views.py @ 1206:02181fa5ac9d modernize tip

Update to Django 1.9.
author Brian Neal <bgneal@gmail.com>
date Wed, 22 Jan 2025 17:58:16 -0600
parents 110bbc78a482
children
line wrap: on
line diff
--- a/comments/views.py	Sat Jan 04 21:34:31 2025 -0600
+++ b/comments/views.py	Wed Jan 22 17:58:16 2025 -0600
@@ -2,12 +2,12 @@
 Views for the comments application.
 
 """
+from django.apps import apps
 from django.contrib.auth.decorators import login_required
 from django.core.exceptions import ObjectDoesNotExist
 from django.http import HttpResponse
 from django.http import HttpResponseBadRequest
 from django.http import HttpResponseForbidden
-from django.db.models import get_model
 from django.shortcuts import render
 from django.utils.html import escape
 from django.views.decorators.http import require_POST
@@ -51,7 +51,7 @@
         return HttpResponseBadRequest('Missing content_type or object_pk field.')
 
     try:
-        model = get_model(*ctype.split('.', 1))
+        model = apps.get_model(*ctype.split('.', 1))
         target = model.objects.get(pk=object_pk)
     except TypeError:
         return HttpResponseBadRequest(