views:

92

answers:

2

I find that it's pretty common most people hardcode the navigation into their templates, but I'm dealing with a pretty dynamic news site which might be better off if the primary nav was db driven.

So I was thinking of having a Navigation model where each row would be a link.

link_id INT primary key
link_name varchar(255)
url varchar(255)
order INT
active boolean

If anyone's done something similar in the past, would you say this sort of schema is good enough?

I also wanted for there to be an optional dropdown in the admin near the url field so that a user could choose a Category model's slug since category links would be common, but I'm not quite sure how that would be possible.

+2  A: 

You might want to look at FeinCMS, which is a good barebone solution if you want to add navigation to a site easily (why invent the wheel twice?) http://spinlock.ch/pub/feincms/html/

Hope it helps!

marty3d
A: 

It might be worth it to look at a full-fledged CMS for Django like FeinCMS or Django-CMS-2 (I'd vote for the former, but that's hardly surprising since I'm the primary author...)

If this does not fit your needs, you might still want to look at something like django-mptt instead of writing some homebrewn hierarchy and ordering code using parent foreign keys and order integer fields.

Matthias Kestenholz