From a2fa71358538514e1d5dc51b75e343a4f14c8d7d Mon Sep 17 00:00:00 2001 From: Guillaume Englert Date: Wed, 27 Jan 2021 21:29:33 +0100 Subject: [PATCH] The method 'creme_core.apps.CremeCoreConfig.tag_ctype()' has been removed. The work is done is the ContentType's AppConfig instead. --- CHANGELOG.txt | 6 ++++++ creme/creme_core/apps.py | 29 +++++++++++++++++------------ 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/CHANGELOG.txt b/CHANGELOG.txt index 6b77ab4545..a7dfd3e72a 100644 --- a/CHANGELOG.txt +++ b/CHANGELOG.txt @@ -115,6 +115,12 @@ * Projects : - The of the field 'models.AbstractProjectTask.parent_tasks' has been renamed "children" (it was "children_set"). + Internal breaking changes : + --------------------------- + (they should not cause problem if you have not deeply modified the source code of Creme) + + # The method 'creme_core.apps.CremeCoreConfig.tag_ctype()' has been removed. + == Version 2.2 == diff --git a/creme/creme_core/apps.py b/creme/creme_core/apps.py index 95e2d2dbe1..a065639801 100644 --- a/creme/creme_core/apps.py +++ b/creme/creme_core/apps.py @@ -146,10 +146,15 @@ def ready(self): super().ready() from django.contrib.contenttypes.models import ContentType - assert not ContentType._meta.ordering, \ - 'It seems ContentType has an ordering policy now ?!' - ContentType._meta.ordering = ('id', ) + meta = ContentType._meta + assert not meta.ordering, 'It seems ContentType has an ordering policy now ?!' + + meta.ordering = ('id', ) + + get_ct_field = meta.get_field + for fname in ('app_label', 'model'): + get_ct_field(fname).set_tags(viewable=False) class CremeAppConfig(AppConfig): @@ -385,7 +390,7 @@ def all_apps_ready(self): if self.MIGRATION_MODE: return - self.tag_ctype() + # self.tag_ctype() self.hook_fk_formfield() self.hook_fk_check() @@ -765,14 +770,14 @@ def hook_multiselection_widgets(): forms.MultipleChoiceField.widget = forms.ModelMultipleChoiceField.widget = \ widgets.UnorderedMultipleChoiceWidget - @staticmethod - def tag_ctype(): - from django.contrib.contenttypes.models import ContentType - - get_ct_field = ContentType._meta.get_field - - for fname in ('app_label', 'model'): - get_ct_field(fname).set_tags(viewable=False) + # @staticmethod + # def tag_ctype(): + # from django.contrib.contenttypes.models import ContentType + # + # get_ct_field = ContentType._meta.get_field + # + # for fname in ('app_label', 'model'): + # get_ct_field(fname).set_tags(viewable=False) def creme_app_configs():