Skip to content

Instantly share code, notes, and snippets.

@jpic
Created February 1, 2016 22:30
Show Gist options
  • Save jpic/c30724a5a90b258a312a to your computer and use it in GitHub Desktop.
Save jpic/c30724a5a90b258a312a to your computer and use it in GitHub Desktop.
class ModelChoiceModelField(ModelChoiceField):
def value_from_object(self, instance, name):
return getattr(instance, name)
def save_form_data(self, instance, name, value):
setattr(instance, name, value)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment