question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filtering on action_object: Field 'action_object' does not generate an automatic reverse relation and therefore cannot be used for reverse querying.

See original GitHub issue

Hi! I used your example from https://github.com/django-notifications/django-notifications/issues/64#issuecomment-111934724 to add a Notification model that is saved as the action_object.

However, when in the stream I try to return sender.actor_actions.filter('action_object__read': False) (sender ist the current user), Django fails with Field 'action_object' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. If it is a GenericForeignKey, consider adding a GenericRelation.

I don’t really understand this error, because I am not actually querying in reverse here, am I?

Any ideas?

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:2
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
maguricommented, Dec 29, 2016

Similar issue here. Any idea?

2reactions
graupcommented, Mar 5, 2016

I succeeded a bit with adding the GenericRelation and querying based on the related_name I gave that. However, then it failed because my model’s pk was an Integer, while action_object_id is a CharField (which PostgreSQL doesnt like).

I’ll create a test project to showcase this problem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to traverse a GenericForeignKey in Django?
filter(bar__name='bar x') FieldError: Field 'bar' does not generate an automatic reverse relation and therefore cannot be used for reverse ...
Read more >
Field 'actor' does not generate an automatic reverse relation ...
Filter Action Error: Field 'actor' does not generate an automatic reverse relation and therefore cannot be used for reverse querying. #318.
Read more >
IBM Cognos Analytics - Reporting Version 11.1 : User Guide
IBM Cognos Analytics - Reporting automatically creates the queries you need as you build reports. However, you can modify these queries or create...
Read more >
Rules and Policies 7 Administration for SonicOS - SonicWall
This is an overview of the SonicWall network security appliance default access rules and custom access rules. Access rules are network management tools...
Read more >
Visual Policy Manager Reference | TechDocs - Broadcom Inc.
does not assume any liability arising out of the application or use of this information, ... Creating the Reverse DNS Lookup Restriction List...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found