@receiver(signals.post_save, sender=core_models.User)
def create_user_limits(sender, instance, **kwargs):
    if not kwargs.get("created"):
        return
    request = lib_signals.get_request()
    creator = request.user if request else None
    for name, definition in utils.get_user_limit_templates():
        ct = ContentType.objects.get_by_natural_key(
            *definition["content_type"].split("."))
        max_value = 0
        # creator can be None if user was created by a factory
        if not creator or creator.is_superuser:
            max_value = int(
                parameters.get_admin(
                    "DEFLT_USER_{}_LIMIT".format(name.upper())))
        models.UserObjectLimit.objects.create(
            user=instance, name=name, content_type=ct, max_value=max_value)
Create limits for new user.
dataset/ETHPy150Open tonioo/modoboa/modoboa/limits/handlers.py/create_user_limits