[Toaster] question about "build.target_set"
Damian, Alexandru
alexandru.damian at intel.com
Mon Mar 24 08:28:25 PDT 2014
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 <dave.lerner at windriver.com>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: 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
> >
> >
> --
> _______________________________________________
> toaster mailing list
> toaster at yoctoproject.org
> https://lists.yoctoproject.org/listinfo/toaster
>
--
Alex Damian
Yocto Project
SSG / OTC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20140324/b4e1245d/attachment.html>
More information about the toaster
mailing list