All of lore.kernel.org
 help / color / mirror / Atom feed
* question about "build.target_set"
@ 2014-03-21 13:29 Reyna, David
  2014-03-21 15:38 ` Lerner, Dave
  0 siblings, 1 reply; 3+ messages in thread
From: Reyna, David @ 2014-03-21 13:29 UTC (permalink / raw)
  To: toaster

[-- Attachment #1: Type: text/plain, Size: 415 bytes --]

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



[-- Attachment #2: Type: text/html, Size: 987 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question about "build.target_set"
  2014-03-21 13:29 question about "build.target_set" Reyna, David
@ 2014-03-21 15:38 ` Lerner, Dave
  2014-03-24 15:28   ` Damian, Alexandru
  0 siblings, 1 reply; 3+ messages in thread
From: Lerner, Dave @ 2014-03-21 15:38 UTC (permalink / raw)
  To: Reyna, David; +Cc: toaster

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: question about "build.target_set"
  2014-03-21 15:38 ` Lerner, Dave
@ 2014-03-24 15:28   ` Damian, Alexandru
  0 siblings, 0 replies; 3+ messages in thread
From: Damian, Alexandru @ 2014-03-24 15:28 UTC (permalink / raw)
  To: Lerner, Dave; +Cc: toaster

[-- Attachment #1: Type: text/plain, Size: 2332 bytes --]

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



-- 
Alex Damian
Yocto Project
SSG / OTC

[-- Attachment #2: Type: text/html, Size: 3761 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2014-03-24 15:28 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-03-21 13:29 question about "build.target_set" Reyna, David
2014-03-21 15:38 ` Lerner, Dave
2014-03-24 15:28   ` Damian, Alexandru

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.