code: def save_formset_with_author(formset, user):
      
      instances = formset.save(commit=False)
      for obj in formset.deleted_objects:
          obj.delete()
      for instance in instances:
          if user.is_authenticated() and hasattr(instance, 'author') and not instance.author:
              instance.author = user
          instance.save()
      formset.save_m2m()
docs: Проставляет моделям из набора форм автора
      :param formset: набор форм
      :param user: автор
      :return: