[Toaster] question about "build.target_set"

Lerner, Dave dave.lerner at windriver.com
Fri Mar 21 08:38:50 PDT 2014


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: toaster-bounces at yoctoproject.org [mailto:toaster-bounces at yoctoproject.org] On
> Behalf Of Reyna, David
> Sent: Friday, March 21, 2014 8:29 AM
> To: toaster at yoctoproject.org
> 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
> 
> 


More information about the toaster mailing list