2

I am using dfrdmn's neat hack to add a summary row to a Django admin view. Briefly, it overrides the ChangeList for the ModelAdmin to append a new item to self.result_list._result_cache

However, this row is treated like other rows in that:

  • it has a selection box (for performing actions on it)
  • it has clickable link fields (for opening the edit view)
  • it has editable fields (for same-page edits)
  • it is considered part of the result_list when clicking Save (which results in an error)

admin result with actionable summary row - fields to disable are highlighted

How can I disable all of these so that the row is view-only, not selectable and ignored when saving?

As a bonus, displaying nothing for the "Like" field would be nice but is a low priority. (It's a NullBooleanField.)

lofidevops
  • 15,528
  • 14
  • 79
  • 119

0 Answers0