List Info

Thread: Maintaining history of changes to model fields




Maintaining history of changes to model fields
country flaguser name
United States
2007-07-30 01:01:03
Hello

I was wondering what is the best possible way of maintaning
history of
changes to the fields of models.

Like we do in Bug trackers, where we maintain a complete log
of
changes to the fields.

One simple solution that came to my mind is creating a model
History.
as


class History(models.Model):
    model_changed = models.CharField(maxlength=255,
blank=False)
    old_data = models.TextField(blank=False)
    created = models.DateTimeField(auto_now = True)



Then before saving the model objects its old value get
pushed in the
History.old_data in json, pickle or some other format. But
this is
very bad way to do it. Because generating reports is not a
simple task
when using pickled data.

You guys might have faced similar problems, can any one
suggest a
better way of maintaining history.

One thing to consider here however is that models  are
deeply
connected with lot of relationships between them.

Thanks


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


Re: Maintaining history of changes to model fields
country flaguser name
United States
2007-07-30 02:01:29
The admin interface contains a history feature, you might
want to look
at how that works. Apart from a table to record the actual
changes,
there is a "relationship" table that links the
model that is changed
with the log record (i.e. the log isn't tied to a particular
table
because of this).
Table names are "django_admin_log" and
"django_content_type"

 -rob

On Jul 29, 11:01 pm, Mir Nazim <mirna...gmail.com> wrote:
> Hello
>
> I was wondering what is the best possible way of
maintaning history of
> changes to the fields of models.
>
> Like we do in Bug trackers, where we maintain a
complete log of
> changes to the fields.
>
> One simple solution that came to my mind is creating a
model History.
> as
>
> class History(models.Model):
>     model_changed = models.CharField(maxlength=255,
blank=False)
>     old_data = models.TextField(blank=False)
>     created = models.DateTimeField(auto_now = True)
>
> Then before saving the model objects its old value get
pushed in the
> History.old_data in json, pickle or some other format.
But this is
> very bad way to do it. Because generating reports is
not a simple task
> when using pickled data.
>
> You guys might have faced similar problems, can any one
suggest a
> better way of maintaining history.
>
> One thing to consider here however is that models  are
deeply
> connected with lot of relationships between them.
>
> Thanks


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


Re: Maintaining history of changes to model fields
country flaguser name
United States
2007-07-30 03:48:19
Oho yes yes.

Did not realize that. It just escaped my mind.

Thanks a lot for reminding

On Jul 30, 12:01 pm, oggie rob <oz.robhar...gmail.com> wrote:
> The admin interface contains a history feature, you
might want to look
> at how that works. Apart from a table to record the
actual changes,
> there is a "relationship" table that links
the model that is changed
> with the log record (i.e. the log isn't tied to a
particular table
> because of this).
> Table names are "django_admin_log" and
"django_content_type"
>
>  -rob
>
> On Jul 29, 11:01 pm, Mir Nazim <mirna...gmail.com> wrote:
>
> > Hello
>
> > I was wondering what is the best possible way of
maintaning history of
> > changes to the fields of models.
>
> > Like we do in Bug trackers, where we maintain a
complete log of
> > changes to the fields.
>
> > One simple solution that came to my mind is
creating a model History.
> > as
>
> > class History(models.Model):
> >     model_changed =
models.CharField(maxlength=255, blank=False)
> >     old_data = models.TextField(blank=False)
> >     created = models.DateTimeField(auto_now =
True)
>
> > Then before saving the model objects its old value
get pushed in the
> > History.old_data in json, pickle or some other
format. But this is
> > very bad way to do it. Because generating reports
is not a simple task
> > when using pickled data.
>
> > You guys might have faced similar problems, can
any one suggest a
> > better way of maintaining history.
>
> > One thing to consider here however is that models 
are deeply
> > connected with lot of relationships between them.
>
> > Thanks


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


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )