Comments (12)
Forgot to mention: Using Django 1.4.1, South 0.7.6, Django-categories 1.1.4
from django-categories.
Can you try just running ./manage.py syncdb --migrate
.
from django-categories.
It created a M2M table for "categories", but don’t tables have to be created for my M2M "Audience" and "Diagnosis" models? Isn’t that what "add_category_fields" is for?
Or have I misunderstood its purpose?
t
On Sep 27, 2012, at 1:04 PM, Jose Soares wrote:
Can you try just running ./manage.py syncdb --migrate.
—
Reply to this email directly or view it on GitHub.
from django-categories.
Actually, Many-To-Many relations are not connected by a foreign key. A intermediate table is created that has a foreign key to categories and to the other model.
You should have an intermediary table between Category and ResourceEntry.
You have, it seems, discovered a bug in the add_category_fields command, but it shouldn't be relevant for your setup.
If you run your application and go to the ResourceEntry model, do you get an error, or do you see your category fields?
Corey
On Sep 27, 2012, at 1:55 PM, Tereza Snyder [email protected] wrote:
It created a M2M table for "categories", but don’t tables have to be created for my M2M "Audience" and "Diagnosis" models? Isn’t that what "add_category_fields" is for?
Or have I misunderstood its purpose?
t
On Sep 27, 2012, at 1:04 PM, Jose Soares wrote:
Can you try just running ./manage.py syncdb --migrate.
—
Reply to this email directly or view it on GitHub.—
Reply to this email directly or view it on GitHub.
from django-categories.
I do see the category model, but I'm not actually using the category app, Instead I intend to use my Audience and Diagnosis classes based on CategoryBase. In an early attempt to get past this error, I added categories to INSTALLED_APPS in addition to categories.editor. At least I could test whether it would create an intermediate table. It did. So I expected add_category_fields to do the same for my CategoryBase based models as well. But...
from django-categories.
Ok, I think I understand now.
The CATEGORIES_SETTINGS only impacts the categories app. It does nothing for subclasses of CategoryBase.
Assuming that the ResourceEntry is one of your models, you can add the custom admin classes for audience and diagnosis to the ResourceEntry admin inlines.
If you can't modify ResourceEntry's admin class, I can tell you how to do it dynamically, like categories does, but it is more complex.
Corey
On Sep 27, 2012, at 2:25 PM, Tereza Snyder [email protected] wrote:
I do see the category model, but I'm not actually using the category app, Instead I intend to use my Audience and Diagnosis classes based on CategoryBase. In an early attempt to get past this error, I added categories to INSTALLED_APPS in addition to categories.editor. At least I could test whether it would create an intermediate table. It did. So I expected add_category_fields to do the same for my CategoryBase based models as well. But...
—
Reply to this email directly or view it on GitHub.
from django-categories.
Aha! That explains it. I was so looking for a way to attach different sets of categories to the SAME model that I willfully misread the docs.
I am trying mightily to keep my ResourceEntry model self-contained. I would really appreciate directions for how to keep it that way.
t
from django-categories.
Ok, You'll have to do some copying and pasting from the categories app.
In categories.registration has the basic code for modifying other apps, if you want to browse it.
- Basically, you need to create an instance of a ManyToManyField, as if it were part of a model.
field = models.ManyToManyField(Audience)
- Then call the field's contribute_to_class to add it to the ResourceEntry model
field.contribute_to_class(ResourceEntry, 'audience')
- Then you'll need to modify the ResourceEntry's admin class. For that, it will be easier to create a new one and swap it out.
class NewResourceAdmin(admin.ModelAdmin):
inlines = [AudienceInline,]
admin.sites.unregister(ResourceEntry)
admin.sites.register(ResourceEntry, NewResourceAdmin)
I hope this is enough for you to go on. Let me know if you need more help.
Corey
On Sep 27, 2012, at 2:44 PM, Tereza Snyder [email protected] wrote:
Aha! That explains it. I was so looking for a way to attach different sets of categories to the SAME model that I willfully misread the docs.
I am trying mightily to keep my ResourceEntry model self-contained. I would really appreciate directions for how to keep it that way.
t
—
Reply to this email directly or view it on GitHub.
from django-categories.
Thanks. I look forward to conquering this. And if there's really is a bug in add_category_fields, at least I unearthed it for you ;-).
If I succeed, I'll write it up for the docs.
from django-categories.
That would be wonderful. Let me know if you need anything
Sent from my iPhone
On Sep 27, 2012, at 3:25 PM, Tereza Snyder [email protected] wrote:
Thanks. I look forward to conquering this. And if there's really is a bug
in add_category_fields, at least I unearthed it for you ;-).
If I succeed, I'll write it up for the docs.
—
Reply to this email directly or view it on
GitHubhttps://github.com//issues/57#issuecomment-8952743.
from django-categories.
something new on this issue?
from django-categories.
i have fallen into the same problem as the original poster, I don't want to modify the 3rd party app but would like to add categories relationship to it.
from django-categories.
Related Issues (20)
- Overriding Category Detail View HOT 2
- Make manager available in RunPython
- Upgrade version of unicode-slugify? HOT 1
- Missing shipped migration files HOT 1
- Duplicated migrations of models registered through settings HOT 1
- New migration created in site-packages
- New migration created in site-packages
- 'staticfiles' is not a registered tag library. HOT 1
- app list not showing HOT 1
- Implement Jazzband guidelines for django-categories
- Add `jazzband-bot` as maintainer to the Read the Docs project (e.g. URL: https://readthedocs.org/dashboard/django-categories/users/)
- Admin site doesn't show left panel
- Current master not installable from source HOT 2
- Module not found HOT 10
- What is the state of this project? HOT 1
- setting “python_requires” with ">3,!=3.10" is a better way to declare Python compatibility HOT 2
- treetable.js not loaded correctly due to django.jQuery not defined (js load order)
- Doc
- Add support for STORAGES settings introduced in Django 4.2 HOT 1
- New release 1.9.3 HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-categories.