On Tue, Jun 17, 2008 at 5:22 PM, Norman Harman <[EMAIL PROTECTED]> wrote: > > Dan wrote: >> There is a functionality which I am interested in and I wonder what is >> the cleanest and most foward compatible way of doing things. >> >> I want models to sprout a suggest() method which would work like >> save() but keep the data in some structure elsewhere that do not >> modify the original data. Any regular call to that object would work >> as if it wasn't modified. I also want a accept() method that would >> commit the changes (and obviously a reject() method to discard them >> and some way to explore the suggested changes). >> >> I am not interested in history at all. >> >> How would you go about implementing those functionalities? > > First guess, curious if others think its good idea. > > Create model with one2one nullable field "suggestion" and Boolean field > "is_suggestion". > If suggestion is Null then there is no suggestion. > If suggestion is not Null it is id of suggested data. > > The idea is to avoid maintaining two duplicate schemas. > > > Proly change the default Manager to only show is_suggestion == False rows.
That's a great idea! I was thinking of making models just to save the pre/post structure of my data but your idea works much better. Thinking more about it, maybe I'll have suggestions from many users. I could make a model for suggestions with a generic relation to objects that are suggestions. I'd just have to overwrite the default manager in all models that I want to support this (easy with inheritance!). Thanks a lot. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---