In Django admin interface, Is to possible to exclude some of the fields in Inline?
In Django 1.8 exclude = ('fieldname',) does works with admin. ModelAdmin so one does not have to inherit from InlineModelAdmin anymore. Also works in Django 1.6.
Take a look at the Model Meta in the django documentation. Within a Model you can add class Meta this allows additional options for your model which handles things like singular and plural naming. Show activity on this post. inside model.py or inside your customized model file add class meta within a Model Class.
The admin interface is also customizable in many ways. This post is going to focus on one such customization, something called inlines. When two Django models share a foreign key relation, inlines can be used to expose the related model on the parent model page. This can be extremely useful for many applications.
with exclude you can do it
ex:
class Book(models.Model): author = models.ForeignKey(Author) title = models.CharField(max_length=100) short_description = models.CharField(max_length=200) class BookInline(admin.TabularInline): model = Book exclude = ['short_description']
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With