Sobes.tech
Junior — Senior

Optimization of the active users retrieval function

livecode

Task condition

Increase work efficiency and improve the readability of the presented code.

def get_active_users():
    active = []
    for user in User.objects.all():
        if user.is_active:
            active.append(user)
    return active