return response
else:
return HttpResponseRedirect(url)
+
+
+def set_current_object(request, obj, in_url=True):
+ request.CURRENT_OBJECT = obj
+ request.CURRENT_OBJECT_IN_URL = in_url
+
+
+def get_current_object(request, for_url=False):
+ if for_url and not getattr(request, 'CURRENT_OBJECT_IN_URL', True):
+ return None
+ return getattr(request, 'CURRENT_OBJECT', None)