Don't get linkify=True working within Django-Tables2 Column

24 Views Asked by At

I want to display two tables a single page/view (using MultiTableMixin). Within each row there should be links to the instance (display), modification and deletion. Classical access to (c)RUD operations through extra columns compared to the actual model. I also saw a similar question already. But it didn't work as expected.

I wanted to simplify/ clean up my code using linkify instead of LinkColumn. Unfortunately, I already struggle with the display part. The following old style works:

columns.LinkColumn(
    "matching:search",
    args=[A("pk")],
    verbose_name="",
    text="display",
    orderable=False,
)

As stated by the docs, using linkify=True should call the get_absolute_url method of the underlying model instance. The method clearly is present and tested. Hence, I added to the table `display = tables.Column(orderable=False, verbose_name="", linkify=True). But all I get is "--" within the now created display column instead of the wanted link. Looking at the source code I see a needed accessor attribute for the linkify to take effect. Am I understanding something wrong?

Any help to clearify would be appreciated.

0

There are 0 best solutions below