Changes between Version 3 and Version 4 of CookBookManipulatorWithPostpopulatedFields


Ignore:
Timestamp:
Jul 8, 2006, 3:11:20 PM (18 years ago)
Author:
anonymous
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • CookBookManipulatorWithPostpopulatedFields

    v3 v4  
    33== Description ==
    44
    5 If your template should only edit part of an object because some fields are not to be changed by the user, you can use the following view-function-template to do the job. It just populates those fields that are left out of the template and the form and fills in there values from known content. Especially it overwrites fields in the new_data with known values so that users can't just fake POST requests to populate left-out fields.
     5If your template should only edit part of an object because some fields are not to be changed by the user, you can use the following view-function-template to do the job. It just populates those fields that are left out of the template and the form and fills in their values from known content. Especially it overwrites fields in the new_data with known values so that users can't just fake POST requests to populate left-out fields.
    66
    77The code is stolen from my gallery project - there you have a picturefolder that has a path and a slug that point to the filesystem and a user_id that denotes the owner (actually it's a ForeignKey to the auth.users model). So users should never be able to change the owner or change the filesystem path (otherwise they might be able to fetch files from security relevant parts of the filesystem). The following code prevents changing those fields by overwriting them in the POST data with data from the original object. That way even faked POST requests won't get access to those attributes.
Back to Top