It's not really the long methods that are bad practice it's more leaving them like that that is bad.
I mean that the actual act of refactoring your sample from:
varaible_1 = 0
variable_2 = 0
for object in queryset :
if object.condition_condition_a and variable_2 > 0 :
variable 1+= 1
.....
...
.
more conditions to alter the variables
return queryset, and context
to
Status status = new Status();
status.variable1 = 0;
status.variable2 = 0;
for object in queryset :
if object.condition_condition_a and status.variable2 > 0 :
status.variable1 += 1
.....
...
.
more conditions to alter the variables (status)
return queryset, and context
and then to
class Status {
variable1 = 0;
variable2 = 0;
void update(object) {
if object.condition_condition_a and variable2 > 0 {
variable1 += 1
}
}
};
Status status = new Status();
for object in queryset :
status.update(object);
.....
...
.
more conditions to alter the variables (status)
return queryset, and context
you are now well on the way to not just a much shorter method but a much more useable and understandable one.