Skip to content

Instantly share code, notes, and snippets.

View ddurdik's full-sized avatar

Dagan Durdik ddurdik

  • EnergySavvy
  • Seattle, WA
View GitHub Profile
# Define a base form that provides the following functionality for its children:
# ~ Children may use the 'notes' field with some default values set;
# * Children may use the 'notes' field with some customizations;
# * Children may choose not to use the 'notes' field
#
# I've omitted case 1 (marked with a ~) because the interesting stuff is in case 2 (CustomizedNotesLeadRequestForm) and 3 (NoNotesLeadRequestForm)
class BaseLeadRequestForm(ModelForm):
class Meta:
fields = ('notes', 'other_field')
Verifying I am +dagan on my passcard. https://onename.com/dagan
@ddurdik
ddurdik / gist:1285825
Created October 13, 2011 23:30
Script to convert un-localized text to yml keys
# Before:
# { bar, "Difficulty speaking", "How hard?", foo },
# After:
# { bar, "difficulty_speaking", "how_hard", foo },
def fix_key(bad_key)
bad_key.downcase.gsub(/[?:]/, '').gsub('/', ' ').gsub(' ', '_')
end
def fix_info(bad_info)