Skip to content

Instantly share code, notes, and snippets.

@amitness
Created May 24, 2019 06:15
Show Gist options
  • Save amitness/fe9462346dc6ebedd8b9222528d40808 to your computer and use it in GitHub Desktop.
Save amitness/fe9462346dc6ebedd8b9222528d40808 to your computer and use it in GitHub Desktop.
How to use JSONField in model_mommy to generate fixtures

In your tests/init.py file, add the following

from model_mommy import mommy

def generator_function():
    return {}


mommy.generators.add('django_mysql.models.JSONField', generator_function)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment