send_file and send_data
Simple functions for downloading files - send_data sends the data directly, send_file as attachment. May need optimizing for large files.
- files
- download
Simple functions for downloading files - send_data sends the data directly, send_file as attachment. May need optimizing for large files.
create_object and update_project modified to handle newforms (including FileFields). In addition, I have added some extras: 1. extra_fields - this is a dict or callable that contains additional fields to be passed to the form, for example stuff that is in the session. 2. on_success - callback called if form is valid and object created/updated, if this is not set the default behaviour is to send a redirect 3. on_failure - callback called if form is invalid, the default is to redisplay the form. Note that once newforms are finally done these functions are likely to be redundant, as generic views will be updated to use the newforms API, so use with caution.
Allows you to override form fields created by form_for_model or form_for_instance, without having to redefine whole fields for example in form.base_fields.
danjak has posted 3 snippets.