{ "info": { "author": "Simon Baechler", "author_email": "simon@stellanera.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.2", "Programming Language :: Python :: 3.3" ], "description": "Introduction\n============\n\nDjango-Scaffolding creates pseudo-real-world placeholder data for your app.\nData can be any type like names, cities, images and instances of your models.\nIt's not a mocking framework, it creates real django model instances.\n\n.. image:: https://travis-ci.org/sbaechler/django-scaffolding.svg?branch=master\n :target: https://travis-ci.org/sbaechler/django-scaffolding\n\nUsage\n=====\n\nAdd ``scaffolding`` to your INSTALLED_APPS\n\nCreate a ``scaffolds.py`` module within your app directory which contains the Scaffolding classes.\n\nSample ``models.py``::\n\n class Entry(models.Model):\n first_name = models.CharField('First Name', max_length=32)\n last_name = models.CharField('Last Name', max_length=32)\n comment = models.TextField('Comment', blank=True)\n image = models.ImageField(upload_to='uploads/%Y/%m/%d', blank=True, null=True)\n contest = models.ForeignKey(Contest)\n ...\n\nSample ``scaffolds.py``::\n\n import scaffolding\n from scaffolding.library.flickr import FlickrInteresting\n\n class EntryScaffold(object):\n first_name = scaffolding.FirstName(max_length=32)\n last_name = scaffolding.LastName(max_length=32)\n comment = scaffolding.OrBlank(scaffolding.LoremIpsum, paragraphs=1)\n contest = scaffolding.ForeignKey(queryset=Contest.objects.filter(name='testcontest'))\n image = scaffolding.RandomInternetImage(backend=FlickrInteresting)\n\n @classmethod\n finalize(cls, obj):\n # Just an example method\n obj.end_date = obj.start_date + datetime.timedelta(days=60)\n\n\n scaffolding.register(Entry, EntryScaffold)\n\nMind the syntax for ForeignKey fields. You can assign an integer to the field\nbut make sure the element with the corresponding key does exist.\nOf course you can also assign an object to the FK field.\n\nTo use the flickr library you need to have the Flickr API: http://stuvel.eu/flickrapi version 1.4.5 installed.\n\nRun the management command to create the data::\n\n manage.py scaffold myapp.MyModel 20\n\nThe number stands for the number of entries to be created.\n\n\nUsing scaffolding in the interpreter or in views\n================================================\n\nYou can try out the included classes or your own modules in the shell.\nAll classes are generators (called Tubes) that generate the values for the fields.\nstart ./manage.py shell::\n\n >>> from scaffolding import *\n >>> r = RandInt(min=1, max=5)\n >>> r.next()\n [4]\n >>> r.next()\n [2]\n\n >>> n = Name(gender='m')\n >>> n.next()\n [u'Ethan Schmid']\n >>> n.next()\n [u'Michael Schneider']\n\n\nUsing finalize()\n----------------\n\nIf a Scaffold class contains a ``finalize(cls, obj)`` class method, the method is called\nafter the model is created and before it is saved. This makes it possible to\nset properties which are dependent on field values.\n\n\nIncluded Tubes\n==============\n\nName\n----\n\nGenerates a random name. can be 'male', 'female', 'm' or 'f'.\n\n\nFirstName and LastName\n----------------------\n\nGenerates only first or last name. Takes the ``gender`` attribute as well.\n\n\nLoremIpsum\n----------\n\nGenerates a Lorem Ipsum Text. The number of paragraphs is defined in paragraphs.\n\nRandInt\n-------\n\nGenerates a random integer between min and max.\n\nForeignKey\n----------\n\nTakes a queryset and iterates through it. Assigns the\nitem as ``ForeignKey`` to the field. Wraps around if there\nare not enough items.\n\nForeignKeyOrNone\n----------------\n\nThe same for nullable ForeignKeys.\n``split`` is the weight for positives. 0.2 yields 80% None.\n\n\nRandomInternetImage\n-------------------\n\nCreates a random image for an ImageField using an internet source.\nA Flickr 'Daily Interesting images' grabber is included.\n\n\nRandomDate\n----------\n\nCreates a random date between ``startdate`` and ``enddate``.\n``startdate`` and ``enddate`` have to be ``datetime.date`` instances.\n\n\nRandomDatetime\n--------------\n\nCreates a random datetime instance between ``startdate`` and ``enddate``.\n``startdate`` and ``enddate`` have to be ``datetime.datetime`` instances.\nIf a timezone is passed in the parameter ``timezone``, the instance is timezone-aware.\n\n\nUsCity\n------\n\nReturns a name of a US city and state. e.g. \"New York, NY\".\n\n\nBookTitle\n---------\n\nCreates a book title.\nThis is a python implementation of the `Random Title Generator `_.\n\n\nURL\n---\n\nCreates a linkable to URL from a list of about 10000 URLs.\n\n\nRandomEmail\n-----------\n\nCreates a random email. Parameters are ``length`` and ``domain``.\n\n\nAlwaysTrue\n----------\n\nReturns ``True``\n\n\nAlwaysFalse\n-----------\n\nReturns ``False``\n\n\nTrueOrFalse\n-----------\n\nRandomly returns true or false.\nYou can set a ratio for true or false by specifying true or false:\ne.g. ``false=3`` returns 3 times as many False than Trues.\n\n\nStaticValue\n-----------\n\nTakes one argument ``value`` and assigns it to the field.\n\n\nRandomValue\n-----------\n\nTakes a list (not an iterable) as its ``lst`` argument and returns an\nelement from it.\nYou can use this for choice fields as well::\n\n [c[0] for c in MyModel.MYCHOICES]\n\n\nEvery Value\n-----------\n\nTakes an iterable as its ``values`` argument and loops through them in order.\n\n\nOrNone\n------\n\nThis is a special tube that takes another tube as its first argument.\nIt assigns a value from the passed class or None. This is useful for nullable\nfields. You can pass the arguments for the wrapped class as arguments to the\nOrNone class. There is one additional argument: ``split``. This defines a ratio\nof useful to None. A ratio of 0.2 will give you 80% None.\n\n\nOrBlank\n-------\n\nThe same as OrNone, but uses a blank string instead of None.\nIdeal for text fields that have ``blank=True``.\n\n\nUuid\n----\n\nGenerates a unique alphanumeric id. Takes an optional parameter ``format`` which\ncan be one of ``uuid``, ``hex`` or ``int``. Default is ``hex``.\nIf the format is ``uuid`` it generates a Uuid4 instance.\n\n\nContrib\n-------\n\nCrates a Custom Object. The backend class is the first parameter.\nThe backend class has to inherit from Tube::\n\n user = scaffolding.Contrib(FacebookTestUser, app_name='contest')\n\n\nFacebookTestUser\n----------------\n\nCreates a Facebook User from the test users pool of the Facebook app.\nIf there aren't enough test users new ones are automatically created.\nThis requires the django-facebook-graph API.\nhttps://github.com/feinheit/django-facebook-graph\n\nThe module is in ``external.facebook_graph``.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/sbaechler/django-scaffolding/", "keywords": null, "license": "MIT", "maintainer": null, "maintainer_email": null, "name": "django-scaffolding", "package_url": "https://pypi.org/project/django-scaffolding/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-scaffolding/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/sbaechler/django-scaffolding/" }, "release_url": "https://pypi.org/project/django-scaffolding/0.2.6/", "requires_dist": null, "requires_python": null, "summary": "Automatically generate reasonable database entries for your app", "version": "0.2.6" }, "last_serial": 1818491, "releases": { "0.1.0": [], "0.2.0": [ { "comment_text": "", "digests": { "md5": "9c0a4cde22f730ba77a4fad9a64559b1", "sha256": "2612fd02e03648305902ffb84cd88993a29e42648c2b95e6ed72a772e87d4365" }, "downloads": -1, "filename": "django-scaffolding-0.2.0.tar.gz", "has_sig": true, "md5_digest": "9c0a4cde22f730ba77a4fad9a64559b1", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12544, "upload_time": "2013-04-16T16:56:41", "url": "https://files.pythonhosted.org/packages/38/a8/50c0888882182b440b2d8db6f3d112c5f195c4eba00521496bdf3feffc6c/django-scaffolding-0.2.0.tar.gz" } ], "0.2.1": [ { "comment_text": "", "digests": { "md5": "1b1e963e8175b78e66ce49381f25fbb6", "sha256": "f290f14f77622fd9e2b1adb5c68bb8cd8d866927e6b31ab86db077a21d3988ed" }, "downloads": -1, "filename": "django-scaffolding-0.2.1.tar.gz", "has_sig": false, "md5_digest": "1b1e963e8175b78e66ce49381f25fbb6", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 12583, "upload_time": "2013-04-16T17:08:30", "url": "https://files.pythonhosted.org/packages/eb/91/189fd957bbe4f54230f1148dae36e97761968e7de83562df18696ef35595/django-scaffolding-0.2.1.tar.gz" } ], "0.2.2": [ { "comment_text": "", "digests": { "md5": "986c96fa74f5e4e13fca3851dce479d3", "sha256": "21eb1db0baa3634a8cb46f3ba6fb1a773e91df591a1addeeb66f23020b527be3" }, "downloads": -1, "filename": "django-scaffolding-0.2.2.tar.gz", "has_sig": false, "md5_digest": "986c96fa74f5e4e13fca3851dce479d3", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13482, "upload_time": "2013-10-07T09:53:17", "url": "https://files.pythonhosted.org/packages/22/b9/afee1b7e8bdb175767e565db16d6e48b56d424afbb8ab1aa90fd05c205aa/django-scaffolding-0.2.2.tar.gz" } ], "0.2.3": [ { "comment_text": "", "digests": { "md5": "5f46dfb37d9a65c1f4bcdddddd5d0545", "sha256": "a8c68ea36192946fe12f8e5785f787a06bb8624e1ab64821ef41d2f116067e81" }, "downloads": -1, "filename": "django-scaffolding-0.2.3.tar.gz", "has_sig": false, "md5_digest": "5f46dfb37d9a65c1f4bcdddddd5d0545", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 13491, "upload_time": "2013-10-07T10:04:53", "url": "https://files.pythonhosted.org/packages/39/4a/f7c4e1fa1ebdb8dd4016775fe1d53729855292cba5b44837a0aef6883ea0/django-scaffolding-0.2.3.tar.gz" } ], "0.2.4": [ { "comment_text": "", "digests": { "md5": "606dd57ef30db27cdc940a06db28a511", "sha256": "dc3940b98ef2b7b8d055f1d386ac62b92d58543eabfb07d2671c0ff4d70cb2bc" }, "downloads": -1, "filename": "django-scaffolding-0.2.4.tar.gz", "has_sig": false, "md5_digest": "606dd57ef30db27cdc940a06db28a511", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120050, "upload_time": "2015-01-29T10:36:03", "url": "https://files.pythonhosted.org/packages/7f/99/72ea052892bf30d5b58054e775974fb71317508d9ff0f8871cf9d9a676c4/django-scaffolding-0.2.4.tar.gz" } ], "0.2.6": [ { "comment_text": "", "digests": { "md5": "7e8e470acd055837d53148f075da07cd", "sha256": "99cb0b5367aa4f9c081836322de32aa5125af7d8b6d9b765fb6047e92e5ad28e" }, "downloads": -1, "filename": "django-scaffolding-0.2.6.tar.gz", "has_sig": false, "md5_digest": "7e8e470acd055837d53148f075da07cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120117, "upload_time": "2015-10-09T13:03:11", "url": "https://files.pythonhosted.org/packages/ec/39/86e20f8af7377e300bc0147eeecbcdd58622d041539d6be3323377ac8e7e/django-scaffolding-0.2.6.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "7e8e470acd055837d53148f075da07cd", "sha256": "99cb0b5367aa4f9c081836322de32aa5125af7d8b6d9b765fb6047e92e5ad28e" }, "downloads": -1, "filename": "django-scaffolding-0.2.6.tar.gz", "has_sig": false, "md5_digest": "7e8e470acd055837d53148f075da07cd", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 120117, "upload_time": "2015-10-09T13:03:11", "url": "https://files.pythonhosted.org/packages/ec/39/86e20f8af7377e300bc0147eeecbcdd58622d041539d6be3323377ac8e7e/django-scaffolding-0.2.6.tar.gz" } ] }