HI, Artemis,

If I understand you correctly you want to use a Select Widget for your
CharField. And feed your choices to the select widget.

In your admin.py file of your app you will want to override the model's form
field.


# models.py
from django.db import models

myModel(models.Model):
  person = models.CharField()
  title = models.CharField()

# admin.py
from django.contrib import admin
from django.forms import widgets

myModelAdmin(admin.ModelAdmin):
  title = CharField(widget=widgets.Select(choices=('mr','mrs','miss'))

admin.site.register(myModel, myModelAdmin)

This code hasnt been tested but should be the route you want to take. You
can find more info on widgets here(
https://docs.djangoproject.com/en/1.3/ref/forms/widgets/). I hope this helps
you.

-Brian

On Sun, Oct 2, 2011 at 12:20 PM, Artemis <cleve.jo...@googlemail.com> wrote:

> Hi,
>
> I have an model which contains a CharField.
> Now I want to have different subclasses of this model each one with
> different *choices* for the CharFiel. How can I implement this?
>
> --
> 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.
>
>

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