James Bennett wrote: > This is probably the way to do it; adding special-case hooks to the > generic views doesn't sound like a good solution to me.
Well, callables which can be sent into generic views and are executed just prior to handing off to the template in order to populate additional context to the form. I'm trying to get (near) equivalent functionality to occur just prior to the database save. I certainly wouldn't call it an elegant solution, but the status quo doesn't seem to provide this functionality which is even less elegant. I'd ideally like to see the generic views for creation and modification of an object be powerful enough to be used for the admin interface, but without some way of attaching functionality into the view prior to key events like object saves, I think generic views just don't have the power at this point. Another use case for this kind of functionality might be to perform auto slugification for fields, so that end users wouldn't have to create their own slugs. > For getting access to the object, I believe that when the 'post_save' > dispatcher signal is sent after saving, one of the included attributes > of the signal is the object itself. Yes, but you'd still have to associate that with with the request object that was passed to the generic view so that the user id of the creator/modifier of the object can be associated with the log record. It also wouldn't seem to give an indication of what the object's state was before being modified. I guess I see the fact that a callable can be sent into a generic view to be run as part of the extra_context parameter as a usefull pre_ hook for a generic view when the view is called as a 'GET' and I'm wishing similar functionality existed when the view is called as a POST. -- William --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---