'Returns a Form class for use in the admin add view. This is used by
add_view and change_view.'

def get_form(self, request, obj=None, **kwargs):

    if self.declared_fieldsets:
        fields = flatten_fieldsets(self.declared_fieldsets)
    else:
        fields = None
    if (self.exclude is None):
        exclude = []
    else:
        exclude = list(self.exclude)
    exclude.extend(kwargs.get('exclude', []))
    exclude.extend(self.get_readonly_fields(request, obj))
    exclude = (exclude or None)
    defaults = {'form': self.form, 'fields': fields, 'exclude': exclude, 'formfield_callback': curry(self.formfield_for_dbfield, request=request)}
    defaults.update(kwargs)
    return modelform_factory(self.model, **defaults)
