Hi Brad, On Sun, 2006-10-01 at 18:07 -0700, brad wrote: > Hello. I am trying to build a view to lookup a model field and return > an array based on the data sent to the view. The goal is to send the > contents of the "value" tag in an html select statement( i.e. in > <option value=SOME_VALUE>OPTION</option> to send the SOME_VALUE part) > to a Django view with a Dojo request call, have the Django view build > an array based on SOME_VALUE, and ultimately send the array back > through "return HttpResponse(array). So far I understand how to send > the contents of the "value" tag and how to send the array back through > the "return" statement. However, I do not know how to build the array. > Belowe I posted a segment of my "models.py", and in it you can see that > I will want to populate the array with valus from the model field > "name" in the class Game. I want to use SOME_VALUE to filter out the > rows in the field "name" that have name.id == SOME_VALUE. Any thoughts > on how I may accomplish this? Thank you in advanced for any help that I > may receive. Here's what I have so far:
I'm still a little confused about what you are wanting to do here. My problem is that there is nothing called "name.id" in your models. The Game model has a name field that will be a text string. Each Game model will also have an implicit primary key field called "id". So there is nothing called "name.id" and filtering on "game.id" will only ever return a single record (or possibly nothing), since the "id" field is unique. Can you provide an example of the behaviour you are looking for? Something along the lines of "if I have these Game instances and I send this value, I want to receive this thing back". Then we should be able to help you. You seem to have solved all the parts that are normally difficult; extracting the right information from your model should be straightforward. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users -~----------~----~----~----~------~----~------~--~---