To get the plus icon back, you need to wrap the field in a
RelatedFieldWidgetWrapper.  Here's an example from my code--obviously,
you'll have to adapt it to fit your situation.

class CategoryChoiceField(forms.ModelChoiceField):

    def __init__(self, *args, **kwargs):
        super(CategoryChoiceField, self).__init__(*args, **kwargs)
        self.widget = widgets.RelatedFieldWidgetWrapper(
            widgets.CategorySelect(
                categories=models.Category.objects.order_by('parent',
'list_order')),
            models.Category._meta.get_field('parent').rel,
            admin.site,
        )

-Jeff

On Dec 9, 6:50 am, Eugene Mirotin <[EMAIL PROTECTED]> wrote:
> Well, looks that the ModelChoiceField solves the problem except of the
> plus icon
>
> On Dec 9, 12:34 pm, Eugene Mirotin <[EMAIL PROTECTED]> wrote:
>
> > Hello. I'm working on the custom admin page  that will serve batch
> > items creation based on the uploaded file.
> > All these items should be linked to the single foreign key item.
> > This item should be selected on the form.
> > Of course, I can investigate the inner structure of the rendered admin
> > pages and mimic it my template, but it doesn't look DRY.
> > So I want to {% include %} the fieldset.html and pass the variable to
> > it that will make it to render the standard ForeignKey control (with
> > "+" icon).
> > Is there a legal way to do it?
>
>
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to