Skip to content

Commit

Permalink
Merge pull request #519 from zmetcalf/django_8_meta_fix
Browse files Browse the repository at this point in the history
Updated get_admin_url_path to work with django 1.8 deprecation
  • Loading branch information
yakky committed May 1, 2015
2 parents 39bddc4 + 6fa38bb commit f62b9ff
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions filer/models/filemodels.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
#-*- coding: utf-8 -*-
from __future__ import unicode_literals

import django
import hashlib
import os

from django.core import urlresolvers
from django.conf import settings
from django.core.files.base import ContentFile
Expand All @@ -12,8 +16,6 @@
from filer.models.foldermodels import Folder
from filer.utils.compatibility import python_2_unicode_compatible
from polymorphic import PolymorphicModel, PolymorphicManager
import hashlib
import os


class FileManager(PolymorphicManager):
Expand Down Expand Up @@ -216,9 +218,13 @@ def __str__(self):
return text

def get_admin_url_path(self):
if django.VERSION < (1, 7):
module_name = self._meta.module_name
else:
module_name = self._meta.model_name
return urlresolvers.reverse(
'admin:%s_%s_change' % (self._meta.app_label,
self._meta.module_name,),
module_name,),
args=(self.pk,)
)

Expand Down

0 comments on commit f62b9ff

Please sign in to comment.