And one more file to render the drop down list, order_closeouts.html below.
Sorry about the messy code. It ain't pretty but it works for me. Let me know
if you have any questions.

I forgot to initialize the form in my view. See views.py below.

Here's some sample code that works for me:

in models.py
class InventoryCloseouts(models.Model):
   prim = models.IntegerField(primary_key=True, db_column='PRIM') #
Field name made lowercase.
   items = models.CharField(max_length=255, db_column='ITEMS',
blank=True) # Field name made lowe
   gen = models.CharField(max_length=255, db_column='GEN',
blank=True) # Field name made lowercase.
   descrip = models.CharField(max_length=255, db_column='DESCRIP',
blank=True) # Field name made l
     .......... etc.
   def __unicode__(self):
        return self.items + ":" + self.gen+":"+self.descrip

in forms.py
class InvtForm2(forms.Form):   #used in closeout order view.
   invent=InventoryCloseouts.objects.all()
   items = forms.ModelMultipleChoiceField(queryset=invent,
             widget=forms.Select(attrs={'class':'colr', }))

in views.py
def order_closeouts(request):
    forms=InvtForm2()
      ............etc.

    return render_to_response('order_closeouts.html', {'forms':forms},
       context_instance = RequestContext(request))

in order_closeouts.html

<div>{{forms.items}}<span id="selection"><--Select Item from complete
list</span></div>

On Wed, Feb 9, 2011 at 9:58 PM, Malcolm MacKinnon <mmack3...@gmail.com>wrote:

>
>
> On Wed, Feb 9, 2011 at 9:54 PM, Mac <mmack3...@gmail.com> wrote:
>
>>
>>
>> On Feb 8, 8:03 am, hank23 <hversem...@stchas.edu> wrote:
>> > I have coded a form which will display some data in a dropdown
>> > selection box. The data is being populated from a a queryset that I
>> > have setup in the form's code. However the entries in the dropdown
>> > only display as objects of the table from which they're being
>> > retrieved, and don't display the actual field data that I was hoping
>> > to have it display. So how do I specify in the form which of the table
>> > fields is to be the display field and which is suppoed to be the
>> > underying key value to be passed when and entry is selected? Thanks
>> > for the help.
>>
>> --
>> 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
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/django-users?hl=en.
>>
>>
>

-- 
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 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to