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):


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

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.

Reply via email to