I need to build recommendation system for my DRF api. That system should range books to a specific user and give the list of book in view. For that purposes i have classes User, Book, Collection and UsersBooksCollections:
 class User(AbstractModel, AbstractBaseUser):
    GENDER_CHOICES = (
        ('М', 'Мужской',),
        ('Ж', 'Женский',),
    )
    email = models.EmailField(_("Почта"), max_length=128, unique=True, db_index=True)
    name = models.CharField(_("Имя"), max_length=32, blank=True)
    password = models.CharField(_("Пароль"), max_length=128)
    gender = models.CharField(_("Пол"), max_length=15, choices=GENDER_CHOICES, blank=True, null=True)
    birthdate = models.DateField(_("Дата рождения"),null=True)
    avatar = models.ImageField(_('Аватар пользователя'), upload_to='images/user/avatars/',
                               default='images/user/avatars/default.jpeg', blank=True,
                               validators=[FileExtensionValidator(allowed_extensions=['jpg', 'png', 'jpeg'])])
    is_active = models.BooleanField(
        _("Активен"),
        help_text=_("Определяет, может ли этот пользователь получить доступ к своей учетной записи"),
        default=True,
    )
    is_admin = models.BooleanField(
        _("Админ"),
        help_text=_("Определяет, может ли пользователь войти в панель администратора"),
        default=False,
    )
    is_staff = models.BooleanField(
        _("Сотрудник"),
        help_text=_("Определяет, может ли пользователь получить доступ к возможностям сотрудника"),
        default=False,
    )

    USERNAME_FIELD = "email"

    object = UserManager()

    def __str__(self):
        return f"{self.email} {self.name}"

    @property
    def is_superuser(self):
        return self.is_admin

    def has_perm(self, perm, obj=None):
        return self.is_active and self.is_admin

    def has_module_perms(self, app_label):
        return self.is_active and self.is_admin

    def get_all_permissions(self, obj=None):
        return []

    class Meta(AbstractModel.Meta):
        verbose_name = _("Пользователь")
        verbose_name_plural = _("Пользователи")

class UsersBooksCollections(AbstractModel):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    book = models.ForeignKey(Book, on_delete=models.CASCADE)
    collection = models.ForeignKey(Collection, on_delete=models.CASCADE)
    current_page = models.IntegerField(_("Текущая страница"), default=0)

    class Meta:
        verbose_name = _("Пользователь-Книга-Коллекция")
        verbose_name_plural = _("Пользователи-Книги-Коллекции")

    def __str__(self):
        return f"{self.user} {self.book} {self.collection}"

class Book(AbstractModel):
    title = models.CharField(_("Название"), max_length=50, unique=True)
    annotation = models.TextField(_("Аннотация"), blank=True)
    symbols_count = models.IntegerField(_("Количество символов"),null = True, blank=True)
    book_file = models.FileField(_('Файл книги'), upload_to='books/files/', null=True, blank=True, default="books/files/default.pdf",
                               validators=[FileExtensionValidator(allowed_extensions=['epub', 'fb2', 'pdf', 'docx'])], max_length=500)
    pages_count = models.IntegerField(_("Количество страниц"), null=True, blank=True)
    is_recognized = models.BooleanField(_("Распознана"), default=False)
    cover = models.FileField(_('Обложка книги'), upload_to='books/covers/', blank=True, default="books/covers/default.jpg",
                               validators=[FileExtensionValidator(allowed_extensions=['jpg', 'png', 'jpeg'])])
    is_private = models.BooleanField(_("Личная"), default=False)
    genres = models.ManyToManyField(Genre)
    authors = models.ManyToManyField(Author)

    class Meta:
        verbose_name = _("Книга")
        verbose_name_plural = _("Книги")

    def __str__(self):
        return self.title

class Collection(AbstractModel):
    title = models.CharField( _("Название"), max_length=100, unique=True)

    class Meta:
        verbose_name = _("Коллекция")
        verbose_name_plural = _("Коллекции")

    def __str__(self):
        return self.title