random_instances 0.0.3

Retrieve or generate random instances of Django models.
An utility to retrieve or generate random instances of Django models.
-------------------------------------

This module exports a get_or_create_random function that improves Django's
get_or_create (http://djangoproject.com/documentation/models/get_or_create/)
on two aspects:

* invoking get_or_create_random with parameters that match MULTIPLE instances
does not raise an error, but rather returns one of those instances at random

* invoking get_or_create_random with parameters that do not match ANY instance
returns a NEW instance of that model (the same occurs with get_or_create). The
improvement is that get_or_create_random can be invoked without passing a value
for all the 'required' fields of the model. If these fields are not passed,
they are automatically filled with random values (e.g.: CharFields are filled
with random strings, ImageFields with random images).

The goal is to make prototyping faster, as model instances can be obtained and
created by specifying just the minimum set of desired fields. This is useful
when writing tests and can avoid having to write complex fixtures.

Author

Red Interactive

Pip

random_instances==0.0.3

Classifiers

  • Environment :: Web Environment
  • Framework :: Django
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Development Status :: 3 - Alpha
  • Natural Language :: English
  • Topic :: Utilities
  • Topic :: Software Development :: Testing
  • Topic :: Software Development :: Documentation
File Type Python Version Uploaded On Downloads
random_instances-0.0.3.tar.gz Source Oct. 5, 2011 2,406
Version Release Date
0.0.3 Oct. 5, 2011
0.0.2 Jan. 21, 2011
0.0.1 Jan. 21, 2011
Date Package Version Action
Aug. 25, 2015, 12:26 a.m. random_instances 0.0.2 Release Created
Aug. 25, 2015, 12:26 a.m. random_instances 0.0.3 Release Created
Aug. 25, 2015, 12:26 a.m. random_instances 0.0.1 Release Created
Aug. 25, 2015, 12:26 a.m. random_instances Package Created