{ "info": { "author": "Chris Davis", "author_email": "defbyte@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: BSD License", "Operating System :: OS Independent", "Programming Language :: Python" ], "description": "\n# django-singleton\n\ndjango-singleton is a fork of Thomas Ashelford's [django-singletons](https://github.com/tttallis/django-singletons).\n\nI forked his code to include Django 1.4 compatibility, as well as to remove the delete button within the admin (see credit below). I had to rename the repository so that I could submit this to the Python Package Index.\n\nNow includes Django 1.6 support, while maintaining backwards compatibility.\n\n[Code from Chris Church's fork](https://github.com/ninemoreminutes/django-singletons/commit/9b231666b9027d3bd1159f3db8bce34701193bdd) - I am merely synthesizing all this..\n\n\n## In Thomas's words\n\nI keep finding myself re-using this simple bit of code, so I thought I should open-source it, even though it's not much more than a snippet.\n\nA SingletonModel is a django model that only ever has one record. You can't use the admin to create a new instance, or delete the existing one.\n\nSome might argue that singleton models are an inefficient way of using a relational database, but in practice it's no biggie - most web sites have some important one-off content (eg. the Home Page), and singleton models map well to how content editors generally think.\n\nI suspect I have cadged some of this code from someone else (likely ex-colleague http://github.com/jphalip/), but a quick Google doesn't show up anything like this already out there. So here it is. I hope you find it useful.\n\n\n### Installation\n\n pip install django-singleton\n\nTo get the custom admin templates working, you need to add \"singleton_models\" to your INSTALLED_APPS\n\n\n### Example Usage\n\nin models.py\n\n from singleton_models.models import SingletonModel\n\n class HomePage(SingletonModel):\n welcome = models.TextField()\n\n def __unicode__(self):\n return u\"The Home Page\" # something like this will make admin message strings more coherent\n\n class Meta:\n verbose_name = \"Home Page\" # once again this will make sure your admin UI doesn't have illogical text\n verbose_name_plural = \"Home Page\"\n\n\nin admin.py\n\n from singleton_models.admin import SingletonModelAdmin\n from models import HomePage\n\n admin.site.register(HomePage, SingletonModelAdmin)\n", "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/defbyte/django-singleton", "keywords": null, "license": "UNKNOWN", "maintainer": null, "maintainer_email": null, "name": "django-singleton", "package_url": "https://pypi.org/project/django-singleton/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-singleton/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/defbyte/django-singleton" }, "release_url": "https://pypi.org/project/django-singleton/0.1.9/", "requires_dist": null, "requires_python": null, "summary": "Reusable singleton models for Django", "version": "0.1.9" }, "last_serial": 1563299, "releases": { "0.1.7": [ { "comment_text": "", "digests": { "md5": "f7fded0f90166ff598378f846ca4cc5b", "sha256": "23d7aaea166434e6c85b2f5f55e2c65850a0daee3e81dd882f782670967a07e2" }, "downloads": -1, "filename": "django-singleton-0.1.7.tar.gz", "has_sig": false, "md5_digest": "f7fded0f90166ff598378f846ca4cc5b", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3319, "upload_time": "2013-01-03T22:55:36", "url": "https://files.pythonhosted.org/packages/9e/8e/556669e1d59425b6da9e2375a2a0e49812fd5d5febda5728c9ada0a7db82/django-singleton-0.1.7.tar.gz" } ], "0.1.8": [ { "comment_text": "", "digests": { "md5": "21423fb822ba1e9ccf58cde1ee78b325", "sha256": "6dfc643824c5062f914c7f5f2c5a551b37be134db6464faa36c297e2c1d1fc01" }, "downloads": -1, "filename": "django-singleton-0.1.8.tar.gz", "has_sig": false, "md5_digest": "21423fb822ba1e9ccf58cde1ee78b325", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3297, "upload_time": "2014-03-24T19:17:41", "url": "https://files.pythonhosted.org/packages/40/2e/5a20e848699fefef0278338f42f6d7c5d5fea170072d5b9d4a2a92fd1c10/django-singleton-0.1.8.tar.gz" } ], "0.1.9": [ { "comment_text": "", "digests": { "md5": "3965600f7fd9a6a27ed05670af62457c", "sha256": "5b495dd2f53d57dc4143497079b837e579ffc8ceba2605196ea87c2403f1a1c9" }, "downloads": -1, "filename": "django-singleton-0.1.9.tar.gz", "has_sig": false, "md5_digest": "3965600f7fd9a6a27ed05670af62457c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3341, "upload_time": "2015-05-26T16:58:16", "url": "https://files.pythonhosted.org/packages/a6/47/0c1410187b7d4e0812135df41431219fcdbe97a33dc30a9a39aef060b0e5/django-singleton-0.1.9.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "3965600f7fd9a6a27ed05670af62457c", "sha256": "5b495dd2f53d57dc4143497079b837e579ffc8ceba2605196ea87c2403f1a1c9" }, "downloads": -1, "filename": "django-singleton-0.1.9.tar.gz", "has_sig": false, "md5_digest": "3965600f7fd9a6a27ed05670af62457c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3341, "upload_time": "2015-05-26T16:58:16", "url": "https://files.pythonhosted.org/packages/a6/47/0c1410187b7d4e0812135df41431219fcdbe97a33dc30a9a39aef060b0e5/django-singleton-0.1.9.tar.gz" } ] }