Keyton Weissinger
unread,Jun 2, 2009, 7:33:00 AM6/2/09Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Django users
I know I'm in the minority, but I'm still having some trouble grokking
the details of generic views. I keep thinking I should be using them
but keep running into the same issue.
Here's my problem: I am building a mgmt site for schools in which
schools sign up for a monthly service fee. Most of my models have a
"school" foreign key which is also part of the user's profile.
So to see, for example, a list of teachers, I do something kind of
like this (assumes login has already occurred):
def myview(request):
current_person = request.user.get_profile()
current_school = current_person.school
teacher_list = Teacher.objects.filter(school=current_school)
etc
Almost everything I have has this school property.
My question is this: How do I leverage generic views in this capacity?
Is there a way to use the request information (specifically
request.user.get_profile().school in my case) in my urls.py when
generating my querysets?
Thank you!
Keyton