Area.objects.values('name','city')
On Jul 31, 5:07 pm, strayhand wrote:
> I want to grab a single column in a model and use it to populate a
> multi-select form field. Here's the code that I'm currently using:
>
> areas = forms.ModelMultipleChoiceField(queryset=Area.objects.all(),
> label='Prefer
Sweet. That did the trick. I found an example here:
http://www.djangoproject.com/documentation/models/str/
# Areas Model UPDATED
from django.db import models
# Create your models here.
class Area(models.Model):
name = models.CharField(max_length=40)
city = models.CharField(max_le
Ah... Well that's exactly what's happening. I'm getting "Area Object"
for each element in the select box. I've seen the __unicode__ method
on a few model examples, but my book and other resources never really
showed or explained it. I'll see if I can find some explanation of it.
Thanks for the clue
On Jul 31, 10:07 am, strayhand wrote:
> I want to grab a single column in a model and use it to populate a
> multi-select form field. Here's the code that I'm currently using:
>
> areas = forms.ModelMultipleChoiceField(queryset=Area.objects.all(),
> label='Preferred Areas', help_text='Select the a
I want to grab a single column in a model and use it to populate a
multi-select form field. Here's the code that I'm currently using:
areas = forms.ModelMultipleChoiceField(queryset=Area.objects.all(),
label='Preferred Areas', help_text='Select the areas that you\'d like
to serve.')
This code ret
5 matches
Mail list logo