Remove Django 1.7 warnings
parent
2582613b77
commit
948749dbdb
|
|
@ -277,8 +277,7 @@ class PolymorphicParentModelAdmin(admin.ModelAdmin):
|
||||||
Expose the custom URLs for the subclasses and the URL resolver.
|
Expose the custom URLs for the subclasses and the URL resolver.
|
||||||
"""
|
"""
|
||||||
urls = super(PolymorphicParentModelAdmin, self).get_urls()
|
urls = super(PolymorphicParentModelAdmin, self).get_urls()
|
||||||
meta = self.model._meta
|
info = _get_opt(self.model)
|
||||||
info = meta.app_label, getattr(meta, 'model_name', meta.module_name)
|
|
||||||
|
|
||||||
# Patch the change URL so it's not a big catch-all; allowing all custom URLs to be added to the end.
|
# 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.
|
# 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:
|
except ValueError:
|
||||||
pass # field not found in form, Django will raise exception later.
|
pass # field not found in form, Django will raise exception later.
|
||||||
return subclass_fields
|
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
|
||||||
|
|
|
||||||
|
|
@ -169,7 +169,7 @@ class PlainMyManagerQuerySet(QuerySet):
|
||||||
|
|
||||||
class PlainMyManager(models.Manager):
|
class PlainMyManager(models.Manager):
|
||||||
def my_queryset_foo(self):
|
def my_queryset_foo(self):
|
||||||
return self.get_query_set().my_queryset_foo()
|
return self.get_queryset().my_queryset_foo()
|
||||||
|
|
||||||
def get_queryset(self):
|
def get_queryset(self):
|
||||||
return PlainMyManagerQuerySet(self.model, using=self._db)
|
return PlainMyManagerQuerySet(self.model, using=self._db)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue