Задать вопрос

Тел: +7 965 3737 888

516

Просмотров

1

Ответов

EditInline for GenericForiegnKey II

This is an update to snippet 765 as I was having trouble getting it to work on branches/newforms-admin @ r7771.

There are just a few minor changes to the previous snippet, all simple stuff. I went ahead an added can_delete and can_order options that the previous snippet didn't include.

More details in blog post.

Вопрос полезен? Да0/Нет0
file_5120.py(3.0Кб)
None

Ответы (1):

Ответmikko:22.07.2008
Ответ полезен? Да0/Нет0

Nice!

from django.newforms.models needs to be from django.forms.models now in 1.0 alpha.

I would also change the default values for ct_field_name and id_field_name to the values they use in the docs, which means you don't have to set them when using admin unless you use other names of cource.

...
class GenericInlineModelAdmin(InlineModelAdmin):
    ct_field_name = 'content_type'
    id_field_name = 'object_id'
    ...