#14684: RESTful Model View ---------------------------+------------------------------------------------ Reporter: gdoermann | Owner: nobody Status: new | Milestone: 1.3 Component: Generic views | Version: 1.3-alpha Keywords: models, views | Stage: Unreviewed Has_patch: 1 | ---------------------------+------------------------------------------------ I love the changes that now allow class views. I am probably a bit late in the discussion, but the problem with how they are currently designed is that in the views/generic/edit.py are not RESTful. You have to have a Create, Update and Delete view for each model. I spent some time writing a ModelView that uses the existing code, but allows for a single model view that takes care of all CRUD. The only drawback is that you must use an "action" hidden field whose name can be specified by the "action_name" variable if you want to delete and your browser does not support the DELETE HTTP verb. This is the current way of handling RESTful applications in non-RESTful browsers (or the best way I have found and read about). It does a safe get on the object so if the pk or slug are not passed in it assumes you are creating a new object (so... this could be changed to use the action key as well, but I just played off of what you were doing in the existing get_object for the ModelFormMixin).
Attached is the generic ModelFormView. Thanks, Greg -- Ticket URL: <http://code.djangoproject.com/ticket/14684> Django <http://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" 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-updates?hl=en.
