'Override to automatically set User.name from attached Django User'

def save(self, *args, **kwargs):

    if ((not self.name) and self.user):
        self.name = self.user.username
    if (not self.default_group):
        try:
            self.default_group = Group.objects.all()[0]
        except Exception:
            pass
    super(User, self).save(*args, **kwargs)
    if (not self.id):
        user_limit = getattr(settings, 'HARDTREE_SUBSCRIPTION_USER_LIMIT', 0)
        if (user_limit > 0):
            user_number = User.objects.all().count()
            if (user_number >= user_limit):
                self.delete()
