On Oct 22, 1:41 pm, Ethan Jucovy <[email protected]> wrote: > Do you need one-time previews ("are you sure you want to save this?") or > real drafts that can be viewed more than once? If you just need an > intermediate preview step for the user who's submitting the data, you can do > it without saving any data on the backend --
The general behavior I want is to have a page with the model form and a "preview" link. The preview link would open a page (likely a new tab) that would display the model as it would appear on my web site. That is, I have a template for each of my models, and I would like to reuse those for rendering my preview objects, though I may have to add an extra parameter to them to disable features only available to live objects. > write a "preview" view that validates the POSTed data without committing > and then > renders a template with a form that includes that data by default, and which > will POST to the real save view. > > I like to put the data in hidden fields, and render a representation of the > previewed data separately. That way the "save for real" form can just look > like a button to the user, and you can have a separate form for modifying > the data and going through the preview cycle again. > > I haven't done anything custom in the django admin, but I assume this > technique can work there too. That was the idea I had. I'd have a view that gets the ModelForm and sends the (unsaved) model to the template. The trick is figuring out how to get access to the ModelForm inside the view, especially when I want to use the admin change form. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---

