I have made a inline named as Fooinline. This inline was working fine in Django 1.02 but as soon as I upgraded to Django 1.1 it started giving an error:
**TypeError at /admin/casd/aaas/4028cb901dd9720a011deadd85e8007f/
__init__() got an unexpected keyword argument 'request'**
My Fooinline
code is:
class FooInline(InlineModelAdmin):
template = 'admin/edit_inline/tabular2.html'
def formfield_for_dbfield(self,db_field, **kwargs): # if isinstance(db_field, (models.ForeignKey, models.ManyToManyField)): # BaseModelAdmin.formfield_for_dbfield(self, db_field, **kwargs) # else: kwargs['widget'] = FlatTextWidget return db_field.formfield(**kwargs)
And my FlatTextWidget
is
class FlatTextWidget(HiddenInput):
def init(self, attrs=None): if attrs is not None: self.attrs = attrs.copy() super(Widget, self).init(attrs) else: self.attrs = {} super(Widget, self).init()
def render(self, name, value, attrs=None): real_field = super(HiddenInput, self).render(name, value, attrs) x = value if x is None: x = '' return mark_safe( '%s%s' % (real_field, x) )
def _has_changed(self, initial, data): return False
I am calling my Fooinline
as
class XYZInline(Fooinline):
model=XYZ