Django example: creating a custom form field widget

I’m back with another Django mini tutorial! This is something that probably a lot of people already know how to do, but since there’s no official documentation for creating custom Django form field widgets, I thought I’d write a post about the information I pieced together in my research. Most of what I learned about creating these widgets came from inspecting GitHub repositories from others who have done this before – so I’m no expert and I’m making a lot of assumptions. Nevertheless, something here might be useful to someone else!

For the project I’m working on I wanted to have a form field to write a short essay for an application. The essay could have a minimum word count, a maximum word count, both or neither. In the help text for the form field I displayed the essay length requirements, but I also wanted to display a word count and indicate if the current length was within the length limits. The resulting control I created looked something like this:

An example screenshot of the django countable field widget

In this mini tutorial I’m going to walk through the steps that I used to create this custom widget.

Continue reading “Django example: creating a custom form field widget”

Make Mistakes

My mantra this year is Make Mistakes. That may seem a bit strange; after all, not many people would remind themselves daily that they should be making mistakes. But two things I’ve come across recently have made me think that this is exactly what we should be telling ourselves.

The first is the TED Radio Hour episode “The Source of Creativity” in which I learned that when musicians are being creative they suppress the pre-frontal cortex of the brain. That’s the area that’s responsible for filtering your actions and words; it’s what keeps you from saying stupid things – or making mistakes.

To sum it up in the episode they tied in a quote from Ken Robinson’s famous TED talk when he said

If you’re not prepared to be wrong you will never come up with anything original. Ken Robinson

The other is this quote from Neil Gaiman from way back in 2011 when he said:

I hope that in this year to come, you make mistakes. Because if you are making mistakes, then you are making new things, trying new things, learning, living, pushing yourself, changing yourself, changing your world. You’re doing things you’ve never done before, and more importantly, you’re doing something. Neil Gaiman

You do anything worth doing if you’re not prepared to make mistakes. And making them only proves that you’re working and creating and getting things done.

So go forth and make some mistakes this year!

SheHacksATX + SheDesignsATX = AWESOME!

This weekend I attended SheHacksATX + SheDesignsATX, an all-female hackathon in Austin, Texas. (Well, mostly-female anyway. A few brave men did come to hang out with us.) SheHacksATX is a little bit different than most hackathons because here designers and developers were teamed up with local women entrepreneurs to help them spruce up their website, develop a new feature, or improve their branding strategy.

SheHacksATX + SheDesignsATX = AWESOME! banner

Continue reading “SheHacksATX + SheDesignsATX = AWESOME!”