Tuesday, February 28, 2012

Re: User actions logging app

Yes, they definitely will.

On 2/28/12, akaariai <akaariai@gmail.com> wrote:
> On Feb 28, 11:35 pm, Mario Gudelj <mario.gud...@gmail.com> wrote:
>> Hi list,
>>
>> I was wandering if someone could recomend an easy django app for logging
>> user actions performed on models. I'd like to log changes logged in users
>> make around the app.
>
> I think there are some apps out there. The first question however is
> do you want to log "user a changed object b" or do you need an audit
> trail also, that is do you need to have the information of user a
> changed object b's field c from value "foo" to value "bar".
>
> I really am not the one to tell you which app is the correct one. I
> usually have a small create_log_entry() method for creating entries
> for modifications, and database triggers for the audit trail. The
> create_log_entry is often the right way to go, as more often than not
> I want to set all changes to the "main" record. That is, if somebody
> changes an article's attachment, it is the article that needs to have
> the changed log entry, not the attachment.
>
> The log entry model is something like this:
> class LogEntry(object):
> to_pk = models.IntegerField() #lets assume you are working only
> with integer primary keys
> to_type = models.CharField(max_length=40, choices=(('article',
> 'Article'), ...))
> mod_type = choices "INSERT/UPDATE/DELETE"
> who = FK(user)
> what = models.TextField() # A "comment" for the edit
> when = models.DateTimeField()
> @classmethod
> def create_log_entry(cls, to_obj, edit_type, user, what_done):
> ...
>
> Combined with database-level triggers you can get a good audit trail.
> I have some scripts to ease maintain the DB triggers for PostgreSQL
> when using Django. I hope I will have some time to polish them for
> release, I believe they could be some use for the community.
>
> - Anssi
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-users@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/django-users?hl=en.
>
>

--
Sent from my mobile device

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment