Add support for a custom user creation function.

This commit is contained in:
Tom Hacohen
2020-07-13 16:20:46 +03:00
parent e41f8455f2
commit c9463cadba
3 changed files with 20 additions and 2 deletions

View File

@@ -10,3 +10,11 @@ def get_user_queryset(queryset, view):
if custom_func is not None:
return custom_func(queryset, view)
return queryset
def create_user(*args, **kwargs):
custom_func = app_settings.CREATE_USER_FUNC
if custom_func is not None:
return custom_func(*args, **kwargs)
_ = kwargs.pop('view')
return User.objects.create_user(*args, **kwargs)