Hi

I have a form being generated in admin with modelForms. Now what I
want is that whenever there is a foreignkey field, there should be a
add new model field sign next to it, as there is in the form generated
using fieldset in admin.

I was able to get the Date widget, but I am not able to get the add
new model sign/widget.

Here is my pseudo code

class TicketFormClosed(ModelForm):
        class Meta:
                model = Ticket
                fields =
('status','call_sheet_number','diagnose','solution','call_attend_date',)
        def __init__(self, *args, **kwargs):
                super(TicketFormClosed, self).__init__(*args, **kwargs)
                self.fields['call_attend_date'].widget = 
widgets.AdminDateWidget()


class TicketAdmin(admin.ModelAdmin):


        def get_form(self, request, obj=None, **kwargs):
                form = super(TicketAdmin, self).get_form(request, obj, **kwargs)
                if obj == None or obj.status=='Open':
                        form = TicketForm
                else:
                        form = TicketFormClosed
                return form

Thanks

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-us...@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