def create_anonymous_user(sender, **kwargs):
 User = get_user_model()
 try:
  lookup = {User.USERNAME_FIELD: guardian_settings.ANONYMOUS_USER_NAME}
  User.objects.get(**lookup)
 except User.DoesNotExist:
  retrieve_anonymous_function = import_string(guardian_settings.GET_INIT_ANONYMOUS_USER)
  user = retrieve_anonymous_function(User)
  user.save()

def create_anonymous_user ( sender , ** kwargs ) : User = get_user_model ( ) try : lookup = { User . USERNAME_FIELD : guardian_settings . ANONYMOUS_USER_NAME } User . objects . get ( ** lookup ) except User . DoesNotExist : retrieve_anonymous_function = import_string ( guardian_settings . GET_INIT_ANONYMOUS_USER ) user = retrieve_anonymous_function ( User ) user . save ( )
creates anonymous user instance with id and username from settings .