Sunday, July 30, 2023

Re: TabularInline

If I understand you wish to have a readonly table view which switches inline to a 'normal' edit view.
I wonder if you could set - has_change_permission back to True in some way?
Could be handy. If you figure it out post here.

On Sunday, 30 July 2023 at 17:33:55 UTC+1 Tolga ÇAĞLAYAN wrote:
Yes, it looks like this table. But how do I make an insertion, deletion, edit here in the normal way. When I press the Add button, I want the page to open to add data here. Thanks for your answer


30 Temmuz 2023 Pazar tarihinde saat 18:15:17 UTC+2 itibarıyla Parthian şunları yazdı:
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/dd1f2f4e-39fb-4252-82fe-ae69ecd530e3n%40googlegroups.com.

No comments:

Post a Comment