Opened 3 years ago

Closed 3 years ago

#18621 closed Cleanup/optimization (duplicate)

Two ManyToMany fields without backwards relation

Reported by: anonymous Owned by: anonymous
Component: Documentation Version: 1.4
Severity: Normal Keywords: backwards relation model
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


I tried to use two ManyToMany fields without allowing a backwards relation on the same model.
I couldn't make it work successfully so i asked about it on StackOverflow, then they thought it may be a bug in django. so i'm posting the issue right here.

Change History (4)

comment:1 Changed 3 years ago by jordinkroy@…

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 3 years ago by jordinkroy@…

  • Owner changed from nobody to anonymous
  • Status changed from new to assigned

comment:3 Changed 3 years ago by aaugustin

  • Component changed from Database layer (models, ORM) to Documentation
  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to Cleanup/optimization

Set related_name='foo+' on one field and related_name='bar+' on the other. It will work.

The documentation could explain that.

That said, Frank's comment isn't wrong:

I would ask why you're bothered by having the backwards relation, just don't use it if you don't want it.

To be honest, I'm not sure why this feature exists!

comment:4 Changed 3 years ago by aaugustin

  • Resolution set to duplicate
  • Status changed from assigned to closed

Actually a duplicate of #15932.

Note: See TracTickets for help on using tickets.
Back to Top