Just a note, if you have a 'related_name' defined for the ForeignKey(Object) field, the "object_set" magic name is replaced with the value of the 'related_name' parameter.
Cheers, Alex On Fri, Mar 21, 2014 at 3:38 PM, Lerner, Dave <[email protected]>wrote: > See > https://docs.djangoproject.com/en/1.5/topics/db/queries/#backwards-related-objects > > " > Following relationships "backward" > ---------------------------------- > If a model has a ForeignKey, instances of the foreign-key model will have > access to a Manager that returns all instances of the first model. By > default, this Manager is named FOO_set, where FOO is the source model name, > lowercased. This Manager returns QuerySets, which can be filtered and > manipulated as described in the "Retrieving objects" section above. > " > > and > https://docs.djangoproject.com/en/1.5/topics/db/queries/#field-lookups-intro > > " Django also creates API accessors for the "other" side of the > relationship - the link from the related model to the model that defines > the relationship. For example, a Blog object b has access to a list of all > related Entry objects via the entry_set attribute: b.entry_set.all()" > > > So for B=build.objects.get(id=1) > b.target_set.all() returns all targets related to the build object b. > > > -dave > > > -----Original Message----- > > From: [email protected] [mailto: > [email protected]] On > > Behalf Of Reyna, David > > Sent: Friday, March 21, 2014 8:29 AM > > To: [email protected] > > Subject: [Toaster] question about "build.target_set" > > > > Hi all, > > > > This is perhaps a dumb question, but where is "target_set" defined, as > per > > "build.target_set" as used in "basebuildpage.html"? > > > > It is not an explicit method of the Build class, I do not find it > defined in the models > > nor views, and google does not obviously find it as a built-in helper > method in Python > > nor Django, unless it is buried somewhere. Maybe I am just not grep'ing > correctly? > > > > - David > > > > > -- > _______________________________________________ > toaster mailing list > [email protected] > https://lists.yoctoproject.org/listinfo/toaster > -- Alex Damian Yocto Project SSG / OTC
-- _______________________________________________ toaster mailing list [email protected] https://lists.yoctoproject.org/listinfo/toaster
