Skip to content

Instantly share code, notes, and snippets.

@lightstrike
Created January 19, 2016 17:39
Show Gist options
  • Save lightstrike/3846830db8730d9667d5 to your computer and use it in GitHub Desktop.
Save lightstrike/3846830db8730d9667d5 to your computer and use it in GitHub Desktop.
Setting up model mommy generators for custom fields
from model_mommy import generators
MOMMY_CUSTOM_FIELDS_GEN = {
'easy_thumbnails.fields.ThumbnailerImageField': generators.gen_image_field,
'model_utils.fields.AutoCreatedField': generators.gen_datetime,
'model_utils.fields.AutoLastModifiedField': generators.gen_datetime,
'django_extensions.db.fields.AutoSlugField': generators.gen_slug,
}
@patroqueeet
Copy link

adding this kind of import in settings is bad practice

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment