On 04/19/2011 09:44 AM, Jonas H. wrote:
> On 04/10/2011 03:14 PM, Jonas H. wrote:
>> What's the preferred way to do a custom model field that has no
>> corresponding formfield? Intuitively, I'd say raise a
>> NotImplementedError, but that would make the whole model unusable in the
>> admin even if that field is excluded from being displayed.

I haven't tried this, but based on the implementation of
`fields_for_model` it looks to me like returning None might work (it
would cause that field to not be included in the SortedDict returned by
fields_for_model, so you wouldn't even need to list that field in
`exclude` - in fact, you couldn't or it would fail validation).

>> So, are fields without a formfield possible already? If yes, how to do
>> it? If not, would you accept a patch that makes the `ModelAdmin.exclude`
>> attribute validation not call into `Field.formfield`?

In theory, yes, although a brief look at the relevant code doesn't
suggest any obvious clean fixes to my mind.

Carl

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers" group.
To post to this group, send email to django-developers@googlegroups.com.
To unsubscribe from this group, send email to 
django-developers+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-developers?hl=en.

Reply via email to