Code

#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

Attachments (0)

Change History (4)

comment:1 Changed 22 months ago by jordinkroy@…

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

comment:2 Changed 22 months ago by jordinkroy@…

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

comment:3 Changed 22 months 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 22 months ago by aaugustin

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

Actually a duplicate of #15932.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.