Skip to content

Instantly share code, notes, and snippets.

View eleddy's full-sized avatar

Elizabeth Leddy eleddy

View GitHub Profile
from django.db import models
from django.contrib.localflavor.us.models import USStateField, PhoneNumberField
def save_area(instance, file_name):
return "photos/%s/%s/%s" % (instance.area.state, instance.area.name, file_name)
# WAT is this? if this is about using nice urls then use url routing instead
def save_problem(instance, file_name):
return "photos/%s/%s/%s/%s" % (instance.problem.parent.state, instance.problem.parent.name, instance.problem.name, file_name)