Creating a db driven primary navigation in django?

Posted by Fedor on Stack Overflow See other posts from Stack Overflow or by Fedor
Published on 2010-03-07T07:16:42Z Indexed on 2010/03/08 16:51 UTC
Read the original article Hit count: 208

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.

© Stack Overflow or respective owner

Related posts about django

Related posts about postgresql