jazzband / django-categories

This app attempts to provide a generic category system that multiple apps could use. It uses MPTT for the tree storage and provides a custom admin for better visualization (copied and modified from feinCMS).
Apache License 2.0
462 stars 136 forks source link

lazy connection, how does it work? #69

Open variable opened 11 years ago

variable commented 11 years ago

I have read about the lazy connection at the bottom of this link https://django-categories.readthedocs.org/en/latest/getting_started.html#connecting-your-model-with-django-categories

I have also read about the actual steps to make it happen in this link https://django-categories.readthedocs.org/en/latest/registering_models.html#registering-models

So I put this inside my settings.py

django-categories

CATEGORIES_SETTINGS = { 'M2M_REGISTRY': { 'articles.Blog': 'categories', } }

when I run "python manage.py add_category_fields articles" I get this error: ImportError: cannot import name MODEL_REGISTRY

I also tried putting the following into init.py from categories import registration from articles.models import Blog registration.register_m2m(Blog)

But nothing happens.

The bottom of this link https://django-categories.readthedocs.org/en/latest/registering_models.html#registering-a-many-to-many-relationship shows sample code using categories.register_m2m, but categories module doesn't have register_m2m, it's inside registration.py. I doubt the accuracy of the document.

coordt commented 11 years ago

It looks like there is an error in the add_category_fields command. I'll get this fixed right away

coordt commented 11 years ago

@variable Can you check the latest commit to see if it solves your problem?

variable commented 11 years ago

Thanks for fixing it, but I couldn't wait for the fix and went ahead hardcoded the foreign key to my models. So now your test is as good as my test.