Skip to content

Field 'actor' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation. #525

Open
@tamhv

Description

@tamhv

Hi everyone, i'm playing with django-activity-stream docs Custom Action Data https://django-activity-stream.readthedocs.io/en/latest/data.html and i found an issue, i seem can't query Action like the docs describe.

env

Django==3.2.9
django-activity-stream==1.4.2

setup

    def ready(self):
        from actstream import registry
        registry.register(apps.get_model(settings.AUTH_USER_MODEL))

django shell

In [9]: action.send(u,verb='started testing activity')
Out[9]: [(<function actstream.actions.action_handler(verb, **kwargs)>,
  <Action: system.admin started testing activity 0 minutes ago>)]
...
In [15]: user_stream(u, with_user_activity=True)
Out [15]: <GFKQuerySet [<Action: system.admin started testing activity 2 minutes ago>]>
...
In [47]: Action.objects.get(actor=u)
ERROR...
FieldError: Field 'actor' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions