I've built this model which contains a generic foreign key:
class MyModel(models.Model):
content_type = models.ForeignKey(ContentType, verbose_name=_('content type'))
object_id = models.PositiveIntegerField(_('object id'))
content_object = generic.GenericForeignKey('content_type', 'object_id')
Next I've made a generic stacked inline to put it in any ModelAmin class:
class MyModelStackedInline(generic.GenericStackedInline):
model = MyModel
formset = generic.generic_inlineformset_factory(MyModel, can_delete=False)
extra = 0
class SomeOhterModelAdmin(admin.ModelAdmin):
inlines = [MyModelStackedInline]
However, despite the can_delete=False
arg passed by in generic_inlineformset_factory, I always see a Delete
checkbox in my admin change_form.
Here is an example: http://img8.imageshack.us/img8/3323/screenshotbe.png
Do you know how to remove this checkbox ?
Thank you :)