I am trying to decorate a Django view by two decorators, one for checking login, and one for checking is_active.
The first one is the built-in @login_required<
Decorators are applied in the order they appear in the source. Thus, your second example:
@login_required
@active_required
def foo(request):
...
is equivalent to the following:
def foo(request):
...
foo = login_required(active_required(foo))
Thus, if the code of one decorator depends on something set by (or ensured by) another, you have to put the dependent decorator "inside" the depdended-on decorator.
However, as Chris Pratt notes, you should avoid having decorator dependencies; when necessary, create a single new decorator that calls both in the right order.