Viewing posts by scoopseven

Multiple Form Fields with the Same Name / Form Field Value as a List in Django

Posted by: scoopseven in Django Python 13 years, 2 months ago
I encountered a scenario where I have a list that I needed to pass over in a form, something like:

read more / 0 comments

WD Scorpion Blue vs Seagate Momentus / 13" Macbook Pro

Posted by: scoopseven in Apple 13 years, 2 months ago
I was recently forced to take my 13" Macbook Pro (2009/Unibody) apart to replace the LCD display. I figured, since I've got it apart, I might as well upgrade the stock 250 GB 5400 rpm stock hard drive with a 500 GB 7200 rpm drive. Bigger + faster = better, right? I got the Seagate Momentus 500 GB 7200 rpm hard disk from PowerbookMedic.com, who had a great price on the LCD. Turns out they marked up the hard disk up about $30 from what it was at Amazon or NewEgg.

read more / 0 comments

Display Tuple Value for Choices Field in Django

Posted by: scoopseven in Django 13 years, 2 months ago
I know, this is an odd name for a post. I'm trying to explain this:

read more / 0 comments

Sort Python Dictionaries by Key or Value

Posted by: scoopseven in Django Python 13 years, 2 months ago
Dictionaries have no __order__ so when you're need to sort one, you're out of luck, right? Not so! Found this goodness with instructions on sorting/ordering Python dictionaries by key or value. I needed to sort a dictionary of regions alphabetically to populate a ChoiceField/select/dropdown box.

read more / 0 comments

Django ChoiceField Empty Option for Select/Dropdown

Posted by: scoopseven in Django Python 13 years, 2 months ago
If you're looking to add a empty_label to your ChoiceField, like you can for ModelChoiceField (empty_label="All"), you're going to have to override __init__ on your form. This solution I found on StackOverflow works well.

read more / 0 comments

Recent Tweets

Recent Posts

Archive

2013
2012
2011
2010
2009
2008
2007
2006

Categories

Authors

Feeds

RSS / Atom