Opened 6 years ago

Closed 6 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 6 years ago by jordinkroy@…

comment:2 Changed 6 years ago by jordinkroy@…

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 Changed 6 years ago by Aymeric Augustin

Component: Database layer (models, ORM)Documentation
Triage Stage: UnreviewedAccepted
Type: BugCleanup/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 6 years ago by Aymeric Augustin

Resolution: duplicate
Status: assignedclosed

Actually a duplicate of #15932.

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