[Toaster] quick question on double key queries

Reyna, David david.reyna at windriver.com
Thu Jan 9 23:46:58 PST 2014


Hi Alex,

Your advice worked!

View:
    tasks  = Task.objects.filter(recipe_id = recipe_id).filter(build_id = build_id)
    packages = Package.objects.filter(recipe_id = recipe_id).filter(build_id = build_id)

By the way, for the “task_executed“ member you have this comment in your model for “Task”, but no “choices” human-string mappings. Should the GUI show display to “Executed”/“Prebuilt” or what Belen used which was “Executed”/”Not executed”.

    task_executed = models.BooleanField(default=False) # True means Executed, False means Prebuilt

- David


From: Damian, Alexandru [mailto:alexandru.damian at intel.com]
Sent: Wednesday, January 08, 2014 7:40 AM
To: Reyna, David
Cc: toaster at yoctoproject.org
Subject: Re: quick question on double key queries

I'd try:

    tasks = Task.objects.filter(recipe_id = recipe_id).filter(build_id = build_id)

I suppose the recipe_id and build_id are coming from the frontend through GET parameters ?

Alex

On Wed, Jan 8, 2014 at 11:17 AM, Reyna, David <david.reyna at windriver.com<mailto:david.reyna at windriver.com>> wrote:
Hi Alex,

Perhaps you can answer this easily? I would like to filter the “Task” data base for the records that match a given recipe_id. It appears that I need to filter for both the FK’s “recipe_id” and “build_id”.

How do I set up that query? I do not think that this is correct:

def recipe(request, build_id, recipe_id):
    …
    tasks  = Task.objects.filter(recipe_id=recipe_id, build_id=build_id)

Thanks,
David





--
Alex Damian
Yocto Project
SSG / OTC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.yoctoproject.org/pipermail/toaster/attachments/20140110/e9805636/attachment.html>


More information about the toaster mailing list