Saturday, January 21, 2017

Re: audit trail functionality in database model

You could have a look at Marty Alchin's Pro Django (not really for
beginners but ...) on page 263 where he shows how to do almost exactly
what you describe. If you got that book it would accelerate your
progress in Django anyway. The only downside is it was published in 2008
and Django has moved on since then - but in a good way. Largely backward
compatible. It is probably still all relevant and very valuable.

Mike

On 21/01/2017 11:15 PM, enrico baranski wrote:
> Hi all Django users,
>
> I'm quite new to Django and currently experimenting with the database
> model. Defining fields appears to be quite intuitive and is well
> described in the documentation. However, I am looking into audit trail
> functionalities. What that means to me. I have two tables, one is my
> master data table (rooms) and one is my audit trail table for the
> rooms table.
>
> So I aim on two major things, first I would like to increment a field
> "version" in my room-table to track any change on the table record.
> Inserting the record means version=1 and as soon as the record is
> changed the field version should increment to 2 and so on.
>
> Second thing would be to automatically track the changes from one
> version to another in my audit trail table. So I am looking for a way
> to automatically make table entries when I update the main table ...
>
> My final goal is to define the audit trail functionalities in the
> database models so it is forced on any record manipulation.
>
> I hope I could describe my issues comprehensible and would be very
> happy to get some feedback from you guys.
>
>
> Thanks a lot and best regards,
> enrico
> --
> You received this message because you are subscribed to the Google
> Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to django-users+unsubscribe@googlegroups.com
> <mailto:django-users+unsubscribe@googlegroups.com>.
> To post to this group, send email to django-users@googlegroups.com
> <mailto:django-users@googlegroups.com>.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/8f9d2c8e-3fd9-4e75-b628-4e6ff99ee83c%40googlegroups.com
> <https://groups.google.com/d/msgid/django-users/8f9d2c8e-3fd9-4e75-b628-4e6ff99ee83c%40googlegroups.com?utm_medium=email&utm_source=footer>.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/f8316766-1c6a-5bdc-1f9f-23daff0750b7%40dewhirst.com.au.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment