Hi there. My first django Question here ;)

I am trying to make this work:

def _user_gotta_go_somewhere(request):
        gotta_go_through = request.user.get_profile
().gotta_go_through_this_url()
        if gotta_go_through and gotta_go_through != request.path:
                return HttpResponseRedirect(gotta_go_through)

@login_required(redirect_field_name='next')
def my_profile(request):
        _user_gotta_go_somewhere(request)
        ...........

As you can see I made a function that check if the user need to do
something first.
thats why I use request.user.get_profile().gotta_go_through_this_url()
Anyway I think You can see what it does ;o)

this works fine but I dont want to repeat it in all my views:
def my_profile(request):
        gotta_go_through = request.user.get_profile
().gotta_go_through_this_url()
        if gotta_go_through and gotta_go_through != request.path:
                return HttpResponseRedirect(gotta_go_through)
        ...........
Or  maybe you can give me a better solution for this.

Thank You

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@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
-~----------~----~----~----~------~----~------~--~---

Reply via email to