Closed michaeldacanay closed 1 year ago
You can do it with customize_row()
as shown here:
https://github.com/morlandi/django-ajax-datatable#customize-row
Thanks! I just added this to the AjaxDatatableView-derived view, where mymodelname
is the displayed column value for mymodel
model:
def customize_row(self, row, obj):
row['mymodelname'] = '<a href="%s">%s</a>' % (
reverse('admin:myapp_mymodel_change', args=(obj.id,)),
obj.mymodelname
)
return
Is it possible to add a hyperlink to the Change form of a model in Django admin? For example, if there is
mymodel
column, clicking the name in a row will direct to the Changemymodel
form for that model.