No i have processors, i have all the data i need in the template, i just don't know an elegant way to condition out menu items.
This is how my model works ACCESS_CHOICES = ( (1, "Public"), (10, "Private"), (100, "Staff"), (1000, "System") ) class Menu(models.Model): name = models.CharField(max_length=16) class MenuItem(models.Model): menu = models.ForeignKey(Menu) access = models.IntegerField(choices=ACCESS_CHOICES) class MenuSubItem(models.Model): item = models.ForeignKey(MenuItem) access = models.ForeignKey(MenuSubItem) On Sun, Jan 31, 2010 at 5:31 AM, Shawn Milochik <sh...@milochik.com> wrote: > I think you've missed context processors, which is easy to do. I'm assuming > that your issue is that you want to have something passed in the context on > every page load to do something like decide which menu items are available > based upon whether the user is logged in, their privileges, or whatever. > > Context processors allow you to define a dictionary that gets appended to > the context of every response you send, so you can have that common stuff > there. > > 1. Write code to get the values appropriate for the current user or > whatever. Put these in a Python file in your app. > 2. Add that file to the TEMPLATE_CONTEXT_PROCESSORS in your settings.py. > 3. Replace Context() with RequestContext() in your render_to_response > calls. > > If I've missed your actual point, please give more detail. I think this > simplifies what you're trying to do. > > Shawn > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to django-us...@googlegroups.com. > To unsubscribe from this group, send email to > django-users+unsubscr...@googlegroups.com<django-users%2bunsubscr...@googlegroups.com> > . > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > -- "The UNIX system has a command, nice ... in order to be nice to the other users. Nobody ever uses it." - Andrew S. Tanenbaum -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.