From cca497f2b81fa6d7d7797953afda2bcffea8e066 Mon Sep 17 00:00:00 2001 From: Étienne Loks Date: Mon, 21 Aug 2017 22:49:29 +0200 Subject: Django 1.11: adapt all get_field_* to match the current Options API --- ishtar_common/model_merging.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'ishtar_common/model_merging.py') diff --git a/ishtar_common/model_merging.py b/ishtar_common/model_merging.py index be2867cb6..a390f233c 100644 --- a/ishtar_common/model_merging.py +++ b/ishtar_common/model_merging.py @@ -6,6 +6,9 @@ from django.db.models import Model from django.contrib.contenttypes.fields import GenericForeignKey from django.core.exceptions import ObjectDoesNotExist +from ishtar_common.utils import get_all_related_many_to_many_objects, \ + get_all_related_objects + def get_models(): _apps = apps.app_configs.items() @@ -69,7 +72,7 @@ def merge_model_objects(primary_object, alias_objects=[], keep_old=False): for alias_object in alias_objects: # Migrate all foreign key references from alias object to primary # object. - for related_object in alias_object._meta.get_all_related_objects(): + for related_object in get_all_related_objects(alias_object): # The variable name on the alias_object model. alias_varname = related_object.get_accessor_name() # The variable name on the related model. @@ -85,7 +88,7 @@ def merge_model_objects(primary_object, alias_objects=[], keep_old=False): # Migrate all many to many references from alias object to primary # object. related_many_objects = \ - alias_object._meta.get_all_related_many_to_many_objects() + get_all_related_many_to_many_objects(alias_object) related_many_object_names = set() for related_many_object in related_many_objects: alias_varname = related_many_object.get_accessor_name() -- cgit v1.2.3