views:

97

answers:

2

Some advice needed on how I can structure my models for my site. I have seen this post from Django project but still a little lost.

Also come across Django-MPTT - but that's no help and possibly overkill.

I'm looking to have categories & subcategories that are shown in the URLs like this:

mysite.com/Level1/Maths/Calculations/Addition/

mysite.com/Level3/English/

mysite.com/Level2/English/Storytelling/

In my admin interface I'm looking to have drop downs for each level of category or subcategory. Also at each level I will be querying items (another model) like get all items that have the category 'Level1' AND 'Maths'.

There could also be a situation where I have five or more subcategories.

How is it best to create my models for best performance?

It it worth using tagging instead?

+2  A: 

Is it worth using tagging instead?

Absolutely!

You can create views, where on selection of a tag, you display all other tags that are a part of posts that has this tag.

It is not really a big technical problem to create efficient n-hierarchical model. django-mptt and other such projects exist. It is more of a human/social problem to categorize something into that level of order.

Lakshman Prasad
Thanks, I'm not sure that using tags is going to get the taxonomy I need given the URL structure above. Just been looking at Django-LFS source they have multiple categories but again the URL structure just sucks, it's separated using -Is this really that complicated? Surely not.
Bluey
+1  A: 

I guess one important question is, if the order of the categories (in your url) matters? I think both options are good, and if you need a hierarchical model, I think the performance of mptt is quite good!
I think tagging is great because i appears to be more "dynamic" to me. I guess the biggest point is the usablity and how users create items/view them. For a project right now I ended up using both, because then I could use both and with future features assort more to the aspect that is heavier used!

lazerscience
Yes I see your point. I have actually gone with a simple 2 category solution with tagging, still coding it up but think for first revision this should suffice.
Bluey