model_mommy

Object factory for Django
Download

model_mommy Ranking & Summary

Advertisement

  • Rating:
  • License:
  • The Apache License 2.0
  • Publisher Name:
  • Vanderson Mota dos Santos

model_mommy Tags


model_mommy Description

Object factory for Django model_mommy is a Python module for creating objects for testing in Django, inspired in ruby's ObjectDaddy and FactoryGirl. It generate the values according with the field type, but i will add support to custom values as well.Installing:pip install model_mommyBasic Usage:If you have a model like this in your app:class Kid(models.Model): name = models.CharField(max_length=30) age = models.IntegerField() bio = models.TextField() birthday = models.DateField()just call the mommy =):from model_mommy import mommykid = mommy.make_one(Kid)and your object is created! No boring attributes passing like 'foobar' every damn time.mommy also handles relationships. Suppose the kid has a dog:class Dog(models.Model): owner = models.ForeignKey('Kid')when you do:rex = mommy.make_one(Dog)it will also create the Kid, automatically.Currently supports the fields:CharField, TextField, FloatField, ForeignKey, DateField, and all the integer-type Fields Requirements: · Python


model_mommy Related Software