Login

Snippets by danjak

Snippet List

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
Read More

create_object and update_object for newforms

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.

  • newforms
  • forms
  • generic-views
Read More

danjak has posted 3 snippets.