Monday, September 15, 2014 (permalink)
Sometimes in the clean(), clean_FOO or save() methods of a Django form, you need to have additional form instance attributes available. A sample case for this is having user_id available. This is a simple example of how to do it in Class-Based Views.
Assuming this form:
from django import forms ...
Friday, September 12, 2014 (permalink)
BarCamp Django SF!
On October 4th and 5th BarCamp Django SF will be taking place in the Eventbrite office in San Francisco. BarCamp Django SF is a low-cost, community-focused event that's different than any previous multi-day Django conference.
How is BarCamp Django SF different than previous Django conferences and ...
Thursday, July 11, 2013 (permalink)
The following are my notes, observations, and resources on the subject of working with Python 3 (with or without Django).
Recently I've become involved in a couple of Django efforts that used Python 3.3. The quick summary of what I learned is pretty much what I expected: Out ...Read more ...
Monday, July 01, 2013 (permalink)
We (myself and Audrey Roy) have been asked to fill in a tutorial session at EuroPython 2013 on the afternoon July 3rd! Therefore, it is my honor to announce our EuroPython Intro to Django Workshop! (see the bottom of this article for registration instructions)
Bring your laptops and ...
Thursday, June 13, 2013 (permalink)
Friday, May 10, 2013 (permalink)
In the summer of 2010 Frank Wiles of Revsys exposed me to what I later called the "Easy Form Views" pattern when creating Django form function views. I used this technique in a variety of places, including Django Packages and the documentation for django-uni-form (which is rebooted as django-crispy-forms). At ...Read more ...
Tuesday, April 23, 2013 (permalink)
I've heard good things about filepicker.io, which is a service that makes file uploading a much better experience. Unfortunately, the Django package for filepicker.io doesn't work with South. When I try to create a migration using the filepicker.io field using code like the following...
# products ...
Friday, March 29, 2013 (permalink)
In my opinion, the concepts behind Django's non-model forms can be listed in just three (3) bullets:
- Forms render HTML.
- Forms are "just" Python constructs.
- Forms validate dictionaries (Python's Key/Value structure).
Let's dig in!
Forms render HTML.
If I construct a Django form:
# myapp/forms.py ...
Wednesday, March 27, 2013 (permalink)
Tuesday, December 04, 2012 (permalink)
This blog post got started with a tweet.
That tweet got retweeted a lot by developers. And system administrators. And database administrators. And any creative type.
As of December 7th, 2012, it had been retweeted over 500 times, a personal best. Obviously I struck a chord that resonated with a ...Read more ...
Tuesday, November 27, 2012 (permalink)
One virtue of Django Class Based Views (CBVs) is that they come with pretty good default settings. The virtue of this is you can really pare your code down in size and complexity.
For example, here is an implementation of CBVs based on a straight-forward Django model , stuffage.models.Stuff ...Read more ...
Wednesday, November 21, 2012 (permalink)
Backstory: On Saturday, November 17, 2012 Audrey Roy and I decided to participate in the Petcentric hackathon, a Los Angeles area Pet-themed product/coding contest held at Amplify. We arrived a bit late, but armed with Audrey's idea of creating a pet based reference sheet for owners, pet sitters ...Read more ...
Tuesday, October 16, 2012 (permalink)
Today I decided to use the Django class based view (CBV) CreateView, but I wanted to avoid duplications and submit to the view from the front page of a site. The reason was I needed a simple newsletter signup form. This is what I cooked up and should work for ...Read more ...
Wednesday, August 15, 2012 (permalink)
Thursday, August 02, 2012 (permalink)
For 2012, DjangoCon US has moved to Washington, DC, and everyone is invited! If you need financial support to get there, the Django Software Foundation and PyLadies have paired with a number of forward thinking sponsors to help get you there. All genders are eligible for assistance, so don't ...Read more ...
Saturday, July 28, 2012 (permalink)
Today I wanted to use the Django Class Based View (CBV) UpdateView but without a slug identifier in the URL. For example, instead of /profiles/pydanny/ I would go to /my-crazy-profile/. Also, I needed to force authentication.
I've done this with Django functional views a few times times, but ...Read more ...
Wednesday, May 23, 2012 (permalink)
Yesterday I showed how to implement a simple email form for Django using Class Based Views. Today I'm going to extend yesterday's work to use the excellent RECAPTCHA service to help reduce spam content.
This version requires pip installing the following into your virtualenv.
- pip install django-crispy-forms so ...
Tuesday, May 22, 2012 (permalink)
Monday, May 14, 2012 (permalink)
So much of what we like about chocolate comes from Switzerland. For example, Milk Chocolate was invented in Switzerland.
2. Keynote speaker: Jacob Kaplan-Moss
Always a great speaker and fun to be around ...
Thursday, May 10, 2012 (permalink)
First off, out of the box, Django lets you construct API responses with a little work. All you need to do is something like this:
# Copied from https://docs.djangoproject.com/en/1.4/topics/class-based-views/#more-than-just-html from django import http from django.utils import simplejson as json class JSONResponseMixin ...
Wednesday, May 09, 2012 (permalink)
Tuesday, April 10, 2012 (permalink)
Saturday, February 18, 2012 (permalink)