{ "info": { "author": "Mikhail Korobov", "author_email": "kmike84@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 3 - Alpha", "Environment :: Web Environment", "Framework :: Django", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Topic :: Software Development :: Libraries :: Python Modules" ], "description": "=======================\ndjango-admin-decorators\n=======================\n\nDjango's admin accepts callables for list_display and readonly_fields.\nIn order to customize these callables (e.g. annotate them with a description)\ndjango requires developer to set an attribute on a callable\n(e.g. 'short_description'). This is a simple approach and it works.\n\nBut it is easy to make a typo or to forget what attribute should be set\non a callable because there is no autocompletion.\n\nThis app provides an alternative (decorator) syntax for that + a couple\nof other decorators useful for customizing django admin.\n\nInstallation\n------------\n\n::\n\n pip install django-admin-decorators\n\nUsage\n-----\n\n::\n\n from django.contrib import admin\n from admin_decorators import (short_description, limit_width, boolean,\n apply_filter, order_field, allow_tags)\n from myapp.models import MyModel\n\n class MyModelAdmin(admin.ModelAdmin):\n list_display = 'name', '_text', 'has_huge_text', 'html_url'\n readonly_fields = ['name', 'html_url']\n\n @short_description('The text limited to 100 chars')\n @order_field('text')\n @limit_width(100)\n def _text(self, obj):\n return obj.text\n\n @boolean\n @short_description('The text is huge')\n def has_huge_text(self, obj):\n return len(obj.text) > 100\n\n @short_description('link')\n @order_field('url')\n @allow_tags\n @apply_filter('urlize')\n def html_url(self, obj):\n return obj.url\n\n admin.site.register(MyModel, MyModelAdmin)\n\nNote that ``allow_tags`` decorator marks result as safe so it will be html both\nin list_display and readonly_fields.\n\nTake a look at source code for more decorators.\n\nDevelopment\n-----------\n\nDevelopment happens at\n`bitbucket `_ and\n`github `_.\n\nIf you've found a bug or have an idea for a new decorator feel free to open\na ticket and/or send a pull request.", "description_content_type": null, "docs_url": null, "download_url": "UNKNOWN", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://bitbucket.com/kmike/django-admin-decorators/", "keywords": null, "license": "MIT license", "maintainer": null, "maintainer_email": null, "name": "django-admin-decorators", "package_url": "https://pypi.org/project/django-admin-decorators/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-admin-decorators/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://bitbucket.com/kmike/django-admin-decorators/" }, "release_url": "https://pypi.org/project/django-admin-decorators/0.1/", "requires_dist": null, "requires_python": null, "summary": "Extra decorators for django admin", "version": "0.1" }, "last_serial": 654340, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "2e7670f4266641444896a897b8ce2a38", "sha256": "cdb2393fa9de145cbba91fb2cc7281ffab2e6becd294f2f19960e1711ff736bf" }, "downloads": -1, "filename": "django-admin-decorators-0.1.tar.gz", "has_sig": false, "md5_digest": "2e7670f4266641444896a897b8ce2a38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3574, "upload_time": "2012-03-05T01:31:43", "url": "https://files.pythonhosted.org/packages/e5/07/8825af3c4edd247eda5332483dd1794f8e5e7b7868d88479ecfb620a96de/django-admin-decorators-0.1.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "2e7670f4266641444896a897b8ce2a38", "sha256": "cdb2393fa9de145cbba91fb2cc7281ffab2e6becd294f2f19960e1711ff736bf" }, "downloads": -1, "filename": "django-admin-decorators-0.1.tar.gz", "has_sig": false, "md5_digest": "2e7670f4266641444896a897b8ce2a38", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3574, "upload_time": "2012-03-05T01:31:43", "url": "https://files.pythonhosted.org/packages/e5/07/8825af3c4edd247eda5332483dd1794f8e5e7b7868d88479ecfb620a96de/django-admin-decorators-0.1.tar.gz" } ] }