You might modify the manager to store historical entries in a different table with the same structure.
On Jan 16, 2012, at 2:18 AM, Mike Dewhirst <[email protected]> wrote: > On 16/01/2012 5:19pm, Bill Beal wrote: >> Why not have a child model that differs from the one-to-one child model >> in that the parent key is now a foreign key to the parent? When another >> child needs to replace the current one in the one-to-one relationship, >> move the child to the second table where there is a many-to-one >> relationship to the parent, then modify the one-to-one child record. If >> necessary, duplicate the current one-to-one record in the many-to-one >> table. Does this make sense? > > I understand what you mean but it feels a bit yukky. Thinking about it some > more maybe I need a 'hidden' field which gets updated on saving based on the > existence of a more modern child. > > Dunno. > > Thanks > > Mike > > >> >> Bill Beal >> >> On Mon, Jan 16, 2012 at 12:55 AM, Mike Dewhirst <[email protected] >> <mailto:[email protected]>> wrote: >> >> I need a one-to-many to behave like a one-to-one. >> >> The parent instance of my model can only ever have one current child >> instance of another model. Multiple child instances have to exist >> and be kept for the historical record. >> >> The main benefit of one-to-one relationships is that they can be >> mapped together (in the Admin) as an extension of the parent. >> >> In a view I suppose I can use a manager to filter the children into >> a pseudo-one-to-one thingy but how do I do this in the Admin? >> >> Maybe sort them into date order and only show one? Is there a better >> way? >> >> Thanks for any help >> >> Mike >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Django users" group. >> To post to this group, send email to [email protected] >> <mailto:[email protected]>. >> To unsubscribe from this group, send email to >> django-users+unsubscribe@__googlegroups.com >> <mailto:django-users%[email protected]>. >> For more options, visit this group at >> http://groups.google.com/__group/django-users?hl=en >> <http://groups.google.com/group/django-users?hl=en>. >> >> >> -- >> You received this message because you are subscribed to the Google >> Groups "Django users" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/django-users?hl=en. > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/django-users?hl=en. > -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

