Как отключить функцию Follow в Django-Activity-Stream
Я создаю приложение Django с помощью https://github.com/justquick/django-activity-stream. Я зарегистрировал приложение в проекте. К сожалению, встроенная функция отслеживания / подписки приложения конфликтует с моей таблицей Follow - я хочу более детальный контроль, чем позволяет библиотека. Кто-нибудь знает, как отключить функцию или обойти эту проблему?
ERRORS:
actstream.Follow.content_type: (fields.E304) Reverse accessor for 'Follow.content_type' clashes with reverse accessor for 'Follow.content_type'.
HINT: Add or change a related_name argument to the definition for 'Follow.content_type' or 'Follow.content_type'.
actstream.Follow.user: (fields.E304) Reverse accessor for 'Follow.user' clashes with reverse accessor for 'Follow.user'.
HINT: Add or change a related_name argument to the definition for 'Follow.user' or 'Follow.user'.
content.Follow.content_type: (fields.E304) Reverse accessor for 'Follow.content_type' clashes with reverse accessor for 'Follow.content_type'.
HINT: Add or change a related_name argument to the definition for 'Follow.content_type' or 'Follow.content_type'.
content.Follow.user: (fields.E304) Reverse accessor for 'Follow.user' clashes with reverse accessor for 'Follow.user'.
HINT: Add or change a related_name argument to the definition for 'Follow.user' or 'Follow.user'.
Следуйте Модель:
class Follow(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
content_type = models.ForeignKey(ContentType, on_delete=models.CASCADE)
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
1 ответ
Попробуйте добавить related_name к полям вашей модели:
class Follow(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE,
related_name='my_follow_user')
content_type = models.ForeignKey(ContentType,
on_delete=models.CASCADE,
related_name='my_follow_content_type')
object_id = models.PositiveIntegerField()
content_object = GenericForeignKey()
или что-то подобное.
Django Models ref: