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

On Mar 24, 10:59 am, Brian Neal <bgn...@gmail.com> wrote:
> On Mar 24, 8:55 am, Adam Fraser <adam.n.fra...@gmail.com> 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 import models
> > from django.contrib.auth.models import User
> > from projectprofiler.middleware import threadlocals
>
> > #CHOICES defined here
> > #...
>
> > class Project(models.Model):
> >     name  = models.CharField(max_length=200)
> >     complexity                  = models.PositiveIntegerField
> > (choices=COMPLEXITY_CHOICES, default=0)
> >     affiliation                 = models.PositiveIntegerField
> > (choices=AFFILIATION_CHOICES, default=0
> >     description                 = models.TextField(max_length=300,
> > blank=True) # not required
> >    ...etc
>
> > ...as you can see, everything is coming from django.db.models.  I have
> > never had to specify the actual widgets that input the data in the
> > admin pages on the site... they are just automatic.  What confuses me
> > to death is how all I need to do is add "from django import forms" to
> > the above code to make it break.
>
> > -Adam
>
> I thought you were trying to make a form. Are you trying to do all
> this from the admin?
> If that is the case you can provide your own form that the admin will
> use. In that form is where you specify the fields and widgets you
> need.
> Take a look at the forms documentation and also the model-forms docs.
--~--~---------~--~----~------------~-------~--~----~
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