Display latest change in frontend

Hello everyone,

is it somehow possible to display the last change across all my models? I would like to realize a kind of mini logbook, so to speak.

You’ll need to supply some more detail if you want specific help. Can you give an example of what a “last change” might be, and what you would want to see on a page?

Beyond that, you might find that something like django-simple-history might be what you’re after. (I’ve never used it and so can’t recommend it specifically, and there might be other packages that do similar things.)

Let’s assume I have 3 models.

  1. Cars
  2. Bikes
  3. Driver

Two scenarios would be interesting now.

  1. The simpler option: Just tell me in which model an entry was last changed and when that was.

  2. The premium version: Tell me not only in which model something was last changed, but also what.

I hope this makes it a little more understandable.

Note: While django-simple-history handles the common cases, make sure you read the Common Issues — django-simple-history 3.7.0.post1.dev31+gc025d4e documentation page to understand its limitations.

The bottom line from this is that there’s not going to be a “generic” / “catch-all” solution outside the database itself that is going to work in all cases. There are too many situations in Django that don’t fit within the common patterns that, if you’re going to implement a generic solution, you need to ensure that all of your code updating the database works correctly with that solution.

The only methods that I know would guarantee this is a database-based solution using triggers.

Ok, thank you very much for your input. A trigger could be a good variant, especially it would be quick and easy to implement.