A decorator is certainly a clean way to apply consistent checking to a bunch of views. But it is primarily useful if the selection of the view function by the urlconf gives you all you need to know about for what age groups the *CONTENT* is appropriate.
If, on the other hand, different rows in the same table (different instances of the same model) are appropriate for different age groups, then you're stuck with either doing your object query in the decorator and passing it to the view, which might be too magic. (Maybe pass a base queryset to the view for further filtering, but still pretty magic.) A shared function that you call from the view to filter a queryset based on age criteria might feel more explicit. Bill On Wed, Jan 20, 2010 at 5:15 PM, Jeffrey Taggarty <[email protected]> wrote: > Hi Guys, I have a bit of a dilemma in terms of design of a small web > application... > > I have this requirement where content is being served by age group. On > first load the user selects their age group and I store that in the > cookie. I read that cookie and query content for the pages based on > that agegroup cookie. My question is should I use a decorator to check > the cookie on every new page requested to make sure they're getting > the proper content served based on that agegroup in the cookie? I have > about 6 functions in total in my views. I was thinking just writing a > decorator to handle that but I am not sure that's the best way to go > about this. > > Thanks > > > Jeff > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > > > >
-- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

