Opened 4 years ago

Closed 4 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

Description

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.

http://stackoverflow.com/questions/11382801/two-manytomany-fields-without-backwards-relation

Change History (4)

comment:1 Changed 4 years ago by jordinkroy@…

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

comment:2 Changed 4 years ago by jordinkroy@…

Owner: changed from nobody to anonymous
Status: newassigned

comment:3 Changed 4 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 4 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