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 = { models.CommaSeparatedIntegerField: {'widget': forms.SelectMultiple}, } but I get an error " 'module' object has no attribute 'ModelAdmin' " (I verified this from python manage.py shell) My guess is I'm using an older django distribution. Unfortunately, this isn't something I can update since it's on a server I have limited access to. Before taking this tack, I was trying something like this (again, in forms.py) ( http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overriding-the-default-field-types ) class ProjectForm(forms.ModelForm): stains = forms.CommaSeparatedIntegerField (widget=forms.SelectMultiple(choices=STAINS_CHOICES)) class Meta: model = Project ...with this I get a strange error: ViewDoesNotExist at /projectprofiler/admin/projects/project/504/ Tried logout_view in module projectprofiler.projects.views. Error was: 'module' object has no attribute 'CommaSeparatedIntegerField' Request Method: GET Request URL: http://imageweb.broad.mit.edu:8081/projectprofiler/admin/projects/project/504/ Exception Type: ViewDoesNotExist Exception Value: Tried logout_view in module projectprofiler.projects.views. Error was: 'module' object has no attribute 'CommaSeparatedIntegerField' Exception Location: /imaging/analysis/People/imageweb/python-packages/ django/core/urlresolvers.py in _get_callback, line 184 ... In template /home/radon01/afraser/projectprofiler/templates/admin/ base.html, error at line 28 28 <a href="{% url projectprofiler.admin.views.main.password_change %}">{% trans 'Change password' %}</a> ...I can't figure out what the password_change view as to do with the commaseparatedintegerfield. Thanks again :] Adam On Mar 26, 11:39 am, Brian Neal <bgn...@gmail.com> wrote: > On Mar 26, 9:59 am, Adam Fraser <adam.n.fra...@gmail.com> 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=SelectMultiple > > (choices=STAIN_CHOICES)) > > > ...or can I? You suggested something like this earlier only referred > > to forms.CommaSeparatedIntegerField rather than > > models.CommaSeparatedIntegerField. > > > hrm > > Models are simply models. They don't really say much about forms. What > the admin application does is to make some default choices about how > to display your model in the admin interface. It automatically builds > the form to edit your model using some very reasonable defaults. If > you aren't happy with those choices, you can provide the form that the > admin should use instead of the default one. In your form, you are > free to use different widgets for your fields and/or provide custom > behavior. > > The docs describe how to provide your own form to the admin > here:http://docs.djangoproject.com/en/dev/ref/contrib/admin/#form > > You simply provide an attribute on your ModelAdmin called 'form', set > equal to the form class you want the admin to use. This form class > should inherit from ModelForm. You can then customize the widgets and > behavior anyway you would like. > > ModelForms are discussed > here:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#topics-... > > Overriding the default field type for a field on a ModelForm is a bit > further > down:http://docs.djangoproject.com/en/dev/topics/forms/modelforms/#overrid... > > But before you read all that, make sure you understand forms in > Django, in > general:http://docs.djangoproject.com/en/dev/topics/forms/#topics-forms-index > > Armed with that info, you should be able to make a custom form for the > admin to use. Good luck. > > BN --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---