Sunday, July 30, 2023

Re: TabularInline

Try this
class YourModelInline(admin.TabularInline):
    model = YourModel
    fields = ('fields', )
    extra = 0 # looks neater without extras.
    show_change_link = True # puts an icon on the left of each row to edit the row.

    def has_change_permission(self, request, obj=None):
        return False # MAKES EVERYTHING READONLY. AWESOME.
    def has_delete_permission(self, request, obj=None):
        return False # option
    def has_add_permission(self, request, obj=None):
        return False # option
On Sunday, 30 July 2023 at 02:32:51 UTC+1 Tolga ÇAĞLAYAN wrote:
This is what tabularinline looks like. I want a table here instead. I want it to work like normal CRUD. Anyone have an idea about this? 

I don't want that
Ekran görüntüsü 2023-07-29 214456.png
I  want like this
Ekran görüntüsü 2023-07-29 214733.png

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/aafddef3-d10d-46be-9128-00601c21e4dfn%40googlegroups.com.

No comments:

Post a Comment