'Ensure the admin does not go over subscription limit by re-enabling users'

def clean_disabled(self):

    enable = (not self.cleaned_data['disabled'])
    if (self.instance and self.instance.id and enable and self.instance.disabled):
        user_limit = getattr(settings, 'HARDTREE_SUBSCRIPTION_USER_LIMIT', 0)
        if (user_limit > 0):
            user_number = User.objects.filter(disabled=False).count()
            if (user_number >= user_limit):
                raise forms.ValidationError((_("Sorry,    but    your    subscription    does    not    allow    more    than    %d    users.    You're    currently    at    your    limit.") % user_limit))
    return self.cleaned_data['disabled']
