Re: Object data change approvals.
You could use contrib.contenttypes framework to do this pretty easily provided the models you will be working with have a similar structure; they all have a field called 'content' for example that would be editable. You can have a model that is the intermediate which has a generic foreign key which points to the object which was edited. So when someone edits an item , the data in request.POST is used to make a new intermediate item rather than update the item that was actually edited. Then a moderator can decide to apply the update or not This would also create a history of edits on each object and make revision control and reverting rather easy. This means the intermediate model is really the 'Heavy Lifter' of the setup. On Feb 14, 10:36 pm, iliveinaparkwrote: > Thanks very much, Bruno, this is a pretty simple way of doing what I > want. > > Now I just have to figure out to apply it generically over multiple > levels of inheritance =/ > > Cheers mate. > > On Feb 12, 10:00 pm, bruno desthuilliers > > wrote: > > On Feb 12, 11:24 am, bruno desthuilliers > > wrote: > > > (snip) > > > oops, forgot to actually use the custom manager: > > > > class MyModelRevision(models.Model): > > > (snip) > > objects = MyModelRevisionManager() > > > > class Meta: > > > unique_together = (('MyModel', 'published'),) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Object data change approvals.
On Feb 15, 5:36 am, iliveinaparkwrote: > Thanks very much, Bruno, this is a pretty simple way of doing what I > want. Q example, really. A robust working solution will probably be a bit more involved. > Now I just have to figure out to apply it generically over multiple > levels of inheritance =/ > Mmm ORMs and deep inheritance trees often don't work that well together :-/ If it's still time, and if of course the context allow it, you might be better refactoring as much as possible as "mixin" abstract classes. My 2 cents. -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Object data change approvals.
Thanks very much, Bruno, this is a pretty simple way of doing what I want. Now I just have to figure out to apply it generically over multiple levels of inheritance =/ Cheers mate. On Feb 12, 10:00 pm, bruno desthuillierswrote: > On Feb 12, 11:24 am, bruno desthuilliers wrote: > > (snip) > > oops, forgot to actually use the custom manager: > > > class MyModelRevision(models.Model): > > (snip) > objects = MyModelRevisionManager() > > > > > class Meta: > > unique_together = (('MyModel', 'published'),) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Object data change approvals.
On Feb 12, 11:24 am, bruno desthuillierswrote: (snip) oops, forgot to actually use the custom manager: > class MyModelRevision(models.Model): (snip) objects = MyModelRevisionManager() > class Meta: > unique_together = (('MyModel', 'published'),) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Re: Object data change approvals.
On Feb 11, 11:23 pm, iliveinaparkwrote: > Gday all, > > I'm trying to find a way to have changes made to a model object > require approval before becoming the live data on my site. I had > thought about cloning the object, and having the clone stored as a > draft, but making it live would require either swapping all the data > from the draft to the original object, or changing all references to > the original to reference the draft instead. > > Does anyone have any ideas on a nice way to do this class MyModel(models.Model): # unversionned fields lives here def published_revision(self): try: return self.revisions.published()[0] except IndexError: return None class MyModelRevisionManager(models.Manager): use_for_related_fields = True def published(self): return self.filter(published=True) class MyModelRevision(models.Model): mymodel = models.ForeignKey(MyModel, related_name="revisions") published = models.BooleanField(...) # all versionned fields here class Meta: unique_together = (('MyModel', 'published'),) HTH -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Object data change approvals.
Gday all, I'm trying to find a way to have changes made to a model object require approval before becoming the live data on my site. I had thought about cloning the object, and having the clone stored as a draft, but making it live would require either swapping all the data from the draft to the original object, or changing all references to the original to reference the draft instead. Does anyone have any ideas on a nice way to do this? 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-us...@googlegroups.com. To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/django-users?hl=en.