Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. from django.http import HttpResponseRedirect
  2. from django.utils.functional import wraps # keeps name/docstring/etc intact
  3.  
  4. def dashboard(view):
  5.     @wraps(view)
  6.     def out_function(request, *args, **kwargs):
  7.         try:
  8.             profile = request.user.get_profile()
  9.         except:
  10.             profile = False
  11.  
  12.         if profile:
  13.             return view(request, *args, **kwargs)
  14.         else:
  15.             return HttpResponseRedirect("/seller/update")
  16.     return out_function
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement