main_module = sys.modules[__name__] load_models(base_models, local_models, main_module) # TaggableManager is only available when TaggedItem is loaded # so we add tags fields after loading all the coop_local models from django.conf import settings from django.utils.translation import ugettext_lazy as _ if "coop_tag" in settings.INSTALLED_APPS: from coop_tag.managers import TaggableManager # from coop_local.models import TaggedItem # WATCHOUT : There is no import error here, all coop_local models are imported during load_models execution t = TaggableManager(through=TaggedItem, blank=True, verbose_name=_(u'Tags'), help_text="Une liste de tags avec des virgules") t.contribute_to_class(Organization, "tags") t.contribute_to_class(Person, "tags") if "coop_cms" in settings.INSTALLED_APPS: t.contribute_to_class(Article, "tags") if "coop.exchange" in settings.INSTALLED_APPS: t.contribute_to_class(Exchange, "tags") if "coop.agenda" in settings.INSTALLED_APPS: t.contribute_to_class(Event, "tags") if "coop.mailing" in settings.INSTALLED_APPS: t.contribute_to_class(MailingList, "tags") if "coop.project" in settings.INSTALLED_APPS: t.contribute_to_class(Project, "tags") if "coop.doc" in settings.INSTALLED_APPS: t.contribute_to_class(DocResource, "tags")
main_module = sys.modules[__name__] load_models(base_models, local_models, main_module) # TaggableManager is only available when TaggedItem is loaded # so we add tags fields after loading all the coop_local models from django.conf import settings from django.utils.translation import ugettext_lazy as _ if "coop_tag" in settings.INSTALLED_APPS: from coop_tag.managers import TaggableManager # from coop_local.models import TaggedItem t = TaggableManager(through=TaggedItem, blank=True, verbose_name=_(u'Tags'), help_text="Une liste de tags avec des virgules") t.contribute_to_class(Organization, "tags") t.contribute_to_class(Person, "tags") t.contribute_to_class(Offer, "tags") if "coop_cms" in settings.INSTALLED_APPS: t.contribute_to_class(Article, "tags") if "coop.exchange" in settings.INSTALLED_APPS: t.contribute_to_class(Exchange, "tags") if "coop.agenda" in settings.INSTALLED_APPS: t.contribute_to_class(Event, "tags") if "coop.mailing" in settings.INSTALLED_APPS: t.contribute_to_class(MailingList, "tags")
from coop.utils.loading import load_models from coop import base_models from coop_local.models import local_models main_module = sys.modules[__name__] load_models(base_models, local_models, main_module) # TaggableManager is only available when TaggedItem is loaded # so we add tags fields after loading all the coop_local models from django.conf import settings from django.utils.translation import ugettext_lazy as _ if "coop_tag" in settings.INSTALLED_APPS: from coop_tag.managers import TaggableManager # from coop_local.models import TaggedItem t = TaggableManager(through=TaggedItem, blank=True, verbose_name=_(u'Tags'), help_text="Une liste de tags avec des virgules") t.contribute_to_class(Organization, "tags") t.contribute_to_class(Person, "tags") t.contribute_to_class(Offer, "tags") if "coop.exchange" in settings.INSTALLED_APPS: t.contribute_to_class(Exchange, "tags") if "coop.agenda" in settings.INSTALLED_APPS: t.contribute_to_class(Event, "tags") if "coop.mailing" in settings.INSTALLED_APPS: t.contribute_to_class(MailingList, "tags")