Commit 45347d0ae86f7e025197597f41e6d8d078ac8f2d
Committed by
Claude Paroz
1 parent
04b80347
Prevented RemovedInDjango19Warning with get_model
Showing
1 changed file
with
6 additions
and
1 deletions
| ... | ... | @@ -11,6 +11,11 @@ from django.utils.html import escape |
| 11 | 11 | from django.views.decorators.csrf import csrf_protect |
| 12 | 12 | from django.views.decorators.http import require_POST |
| 13 | 13 | |
| 14 | +try: | |
| 15 | + from django.apps import apps | |
| 16 | +except ImportError: | |
| 17 | + from django.db import models as apps | |
| 18 | + | |
| 14 | 19 | import django_comments |
| 15 | 20 | from django_comments import signals |
| 16 | 21 | from django_comments.views.utils import next_redirect, confirmation_view |
| ... | ... | @@ -52,7 +57,7 @@ def post_comment(request, next=None, using=None): |
| 52 | 57 | if ctype is None or object_pk is None: |
| 53 | 58 | return CommentPostBadRequest("Missing content_type or object_pk field.") |
| 54 | 59 | try: |
| 55 | - model = models.get_model(*ctype.split(".", 1)) | |
| 60 | + model = apps.get_model(*ctype.split(".", 1)) | |
| 56 | 61 | target = model._default_manager.using(using).get(pk=object_pk) |
| 57 | 62 | except TypeError: |
| 58 | 63 | return CommentPostBadRequest( | ... | ... |
Please
register
or
login
to post a comment