views:

15

answers:

1

I'm using permissions in my application. And in some case I need to create form only with permission field. I'm using ModelChoiceField and queryset with permission objects.

permission = forms.ModelChoiceField(queryset = Permission.objects.all())

But permissions unicode is taking too much place in choice field. And it looks not so good. I want to use in my choice field only permission's name. Is it possible?

+1  A: 

You can create a proxy model, and override the __unicode__() method on that.

Ignacio Vazquez-Abrams
Thanks! Useful information, but I'm decided to use `ChoiceField` and write choices with permission's id and permission's name. Working :)
Proger