need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
Hello, This should be a pretty simple question. I have a list of options: STAIN_CHOICES = ( (1, 'DNA - DAPI'), (2, 'DNA - Hoechst'), (3, 'DNA - other'), (4, 'Actin - Phalloidin'), (5, 'Tubulin'), ) I would like users to be able to select more than one of these things at a t

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Briel
Hi. I haven't played much around with this kind of thing, but I would suggest that you take a look at the form widgets. One of them is called, SelectMultiple, which I bet is the one you are after, but I'm not sure if it will work with choices. You can find something about it at http://docs.django

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
I don't see anything called SelectMultiple on the page you linked. That was the page I've been scouring for a while now looking for a way to do this. The ModelMultipleChoiceField looks promising, but apparently it's associated with a ManyToManyField model, and that doesn't really fit what I'm goi

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Brian Neal
On Mar 23, 1:49 pm, Adam Fraser wrote: > Hello, > > This should be a pretty simple question.  I have a list of options: > > STAIN_CHOICES = ( >     (1, 'DNA - DAPI'), >     (2, 'DNA - Hoechst'), >     (3, 'DNA - other'), >     (4, 'Actin - Phalloidin'), >     (5, 'Tubulin'), > ) > > I would like

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Adam Fraser
I found the SelectMultiple widget here: http://docs.djangoproject.com/en/dev/ref/forms/widgets/ But I still don't know how to hook that up to a model like CommaSeparatedIntegerField. help? On Mar 23, 3:25 pm, Adam Fraser wrote: > I don't see anything called SelectMultiple on the page you link

Re: need a multiselect list box for a static list of options

2009-03-23 Thread Brian Neal
On Mar 23, 3:36 pm, Adam Fraser wrote: > I found the SelectMultiple widget here: > > http://docs.djangoproject.com/en/dev/ref/forms/widgets/ > > But I still don't know how to hook that up to a model like > CommaSeparatedIntegerField. > > help? > Did you try something like this? This is off the t

Re: need a multiselect list box for a static list of options

2009-03-24 Thread Adam Fraser
Still doesn't work. Maybe I should be more specific. I'm editing projectprofiler/projects/models.py which hasn't needed to import forms for anything, and when I do I get very strange errors. Here's what it looks like now: from django.db import models from django.contrib.auth.models import User

Re: need a multiselect list box for a static list of options

2009-03-24 Thread Brian Neal
On Mar 24, 8:55 am, Adam Fraser wrote: > Still doesn't work.  Maybe I should be more specific. > > I'm editing projectprofiler/projects/models.py which hasn't needed to > import forms for anything, and when I do I get very strange errors. > > Here's what it looks like now: > > from django.db impo

Re: need a multiselect list box for a static list of options

2009-03-26 Thread Adam Fraser
hrm, I think I'm _finally_ starting to understand how django is meant to be used. Question: Why can't I just specify the widget used by a particular field from my model in the admin interface. stains = models.CommaSeparatedIntegerField(widget=SelectMultiple (choices=STAIN_CHOICES)) ...or can I?

Re: need a multiselect list box for a static list of options

2009-03-26 Thread Brian Neal
On Mar 26, 9:59 am, Adam Fraser wrote: > hrm, I think I'm _finally_ starting to understand how django is meant > to be used. > > Question: Why can't I just specify the widget used by a particular > field from my model in the admin interface. > > stains = models.CommaSeparatedIntegerField(widget=S

Re: need a multiselect list box for a static list of options

2009-03-26 Thread Adam Fraser
First, I want to thank you for sticking with me and helping me through this. I've learned a lot, but unfortunately made no progress yet. I read the links you sent and ended up trying this in forms.py: from django.contrib import admin class ProjectAdmin(admin.ModelAdmin): formfield_overrides

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Adam Fraser
Does anyone have a clue why I can't access ModelAdmin in django.contrib.admin? >>> from django.contrib import admin >>> dir(admin) ['__builtins__', '__doc__', '__file__', '__name__', '__path__', 'models'] ??? I'm trying to do this: class ProjectAdmin(admin.ModelAdmin): formfield_overrides

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Alex Gaynor
On Mon, Apr 6, 2009 at 1:40 PM, Adam Fraser wrote: > > Yeah, I just realized I'm running django 0.97 > > On Apr 6, 1:32 pm, Karen Tracey wrote: > > On Mon, Apr 6, 2009 at 11:57 AM, Adam Fraser >wrote: > > > > > > > > > Does anyone have a clue why I can't access ModelAdmin in > > > django.contri

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Karen Tracey
On Mon, Apr 6, 2009 at 11:57 AM, Adam Fraser wrote: > > Does anyone have a clue why I can't access ModelAdmin in > django.contrib.admin? > > >>> from django.contrib import admin > >>> dir(admin) > ['__builtins__', '__doc__', '__file__', '__name__', '__path__', > 'models'] > > ??? > That's the res

Re: need a multiselect list box for a static list of options

2009-04-06 Thread Adam Fraser
Yeah, I just realized I'm running django 0.97 On Apr 6, 1:32 pm, Karen Tracey wrote: > On Mon, Apr 6, 2009 at 11:57 AM, Adam Fraser wrote: > > > > > Does anyone have a clue why I can't access ModelAdmin in > > django.contrib.admin? > > > >>> from django.contrib import admin > > >>> dir(admin) >

Re: need a multiselect list box for a static list of options

2009-04-07 Thread Adam Fraser
Yup: >>> django.get_version() u'0.97-pre-SVN-unknown' On Apr 6, 1:45 pm, Alex Gaynor wrote: > On Mon, Apr 6, 2009 at 1:40 PM, Adam Fraser wrote: > > > Yeah, I just realized I'm running django 0.97 > > > On Apr 6, 1:32 pm, Karen Tracey wrote: > > > On Mon, Apr 6, 2009 at 11:57 AM, Adam Fraser

Re: need a multiselect list box for a static list of options

2009-04-08 Thread ramu...@gmail.com
Adam, did you solve you problem? I try to solve the same problem here http://stackoverflow.com/questions/723639/forms-selectmultiple-from-models-commaseparatedintegerfield On Apr 7, 5:47 pm, Adam Fraser wrote: > Yup:>>> django.get_version() > > u'0.97-pre-SVN-unknown' > > On Apr 6, 1:45 pm, Al