Django-table2: get row primary key to access row extra details
I am trying to get list of products to be displayed as a django table and I am trying to create one column that would be a see more
link to the details page for that one product.
I cannot get the syntax correct for that one specific field and been banging my head off the wall for hours.
here is what I got for tables.py
class ProductsTable(tables.Table):
Details = tables.TemplateColumn('<a href="{% url 'woppa_product_details' pk= record.pk %}">See more</a>')
class Meta:
model = Products
fields = (
'ProductCode',
'ProductName',
'ProductCategory',
)
template_name = "django_tables2/bootstrap4.html"
here is my views.py
def ProductsView(request):
table = ProductsTable(Products.objects.all())
return render(request, 'woppa_inventory_list.html',{'table':table})
and here is urls py
urlpatterns = [
path('woppa_inventory_list', ProductsView, name='woppa_inventory_list'),
path('woppa_product_details/<str:pk>', ProductDetailsView, name="woppa_product_details"),
]
No clue what else to try at this point