Remove Django 1.7 warnings

fix_request_path_info
Diederik van der Boor 2014-10-14 17:30:25 +02:00
parent 2582613b77
commit 948749dbdb
2 changed files with 9 additions and 3 deletions

View File

@ -277,8 +277,7 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
Expose the custom URLs for the subclasses and the URL resolver.
"""
urls = super(PolymorphicParentModelAdmin, self).get_urls()
meta = self.model._meta
info = meta.app_label, getattr(meta, 'model_name', meta.module_name)
info = _get_opt(self.model)
# Patch the change URL so it's not a big catch-all; allowing all custom URLs to be added to the end.
# The url needs to be recreated, patching url.regex is not an option Django 1.4's LocaleRegexProvider changed it.
@ -545,3 +544,10 @@ class PolymorphicChildModelAdmin(admin.ModelAdmin):
except ValueError:
pass # field not found in form, Django will raise exception later.
return subclass_fields
def _get_opt(model):
try:
return model._meta.app_label, model._meta.model_name # Django 1.7 format
except AttributeError:
return model._meta.app_label, model._meta.module_name

View File

@ -169,7 +169,7 @@ class PlainMyManagerQuerySet(QuerySet):
class PlainMyManager(models.Manager):
def my_queryset_foo(self):
return self.get_query_set().my_queryset_foo()
return self.get_queryset().my_queryset_foo()
def get_queryset(self):
return PlainMyManagerQuerySet(self.model, using=self._db)