Login

Snippets by tobias

Snippet List

DateTimeField with microseconds

Use this in your form if you want to accept input in microseconds. In a ModelForm you can override the field like this: def __init__(self, *arg, **kwargs): super(MyForm, self).__init__(*arg, **kwargs) self.fields['date'] = DateTimeWithUsecsField() *Update* May 26 2009 - Updated to address a couple issues with this approach. See http://code.djangoproject.com/ticket/9459

  • forms
  • datetimefield
  • microseconds
Read More

render_with decorator

Automatically render your view using render_to_response with the given template name and context, using RequestContext (if you don't know what this is you probably want to be using it). For example: @render_with('books/ledger/index.html') def ledger_index(request): return { 'accounts': ledger.Account.objects.order_by('number'), }

  • render_to_response
  • requestcontext
  • decorator
  • rendering
Read More

tobias has posted 3 snippets.