{ "info": { "author": "Wang Chao", "author_email": "yueyoum@gmail.com", "bugtrack_url": null, "classifiers": [], "description": "# Duck Admin\nA Django reusable app for show and operate custom forms in admin.\n\n## Purpose\n\nThe Django Admin is great!\nBut it is highly depends on it's orm.\n\nData source not supported by Django's orm (e.g, redis, mongodb) can not show\nin Django's admin site.\n\nThis app help you make your data (in redis, mongodb, file...) show in Django's Admin site.\nEven you can operate with your data. (Add, Modify, Delete)\n\n\n## Install\n\n```\npip install duckadmin\n```\n\n## Usage\n\n1. add `'duckadmin'` in `INSTALLED_APPS`\n2. define your form. (you can place it in `forms.py`, `models.py`, anywhere you like)\n\n Demonstration ( more details see [example](/example/redisapp/forms.py) )\n ```python\n from duckadmin import DuckForm\n \n # We define form (not model)\n class MyRedisForm(DuckForm):\n app_label = 'redisapp' # your app name\n model_name = 'Person' # link url \n verbose_name = 'Person' # name displayed in admin site\n pk_name = 'id'\n \n GENDER = (\n (1, 'male'),\n (2, 'female'),\n )\n \n # fields defined below will show in admin site\n id = forms.IntegerField()\n name = forms.CharField(max_length=32)\n gender = forms.ChoiceField(choices=GENDER)\n age = forms.IntegerField()\n\n # you should implement the api below:\n # `request` is django request instance\n\n @classmethod\n def get_count(cls, request):\n # get count of datasets\n # return integer\n \n @classmethod\n def get_data(cls, request, start, stop):\n # get all data to display in change list page\n # return list of data.\n # data is dict format, key is fields defined above\n \n @classmethod\n def get_data_by_pk(cls, request, pk):\n # change form view\n \n @classmethod\n def create_data(cls, request, data):\n # create new data\n \n @classmethod\n def update_data(cls, request, data):\n # update an exist data\n ```\n\n3. define admin. (in file `admin.py`)\n\n ```python\n from django.contrib import admin\n from duckadmin import DuckAdmin\n from redisapp.forms import MyRedisForm\n \n @admin.register(MyRedisForm)\n class MyRedisAdmin(DuckAdmin):\n duck_form = MyRedisForm\n\n ```\n\nAfter this settings. you will see `Person` in admin site.\n\n![admin](/images/admin.png)\n\nAnd the change list page\n\n![change_list](/images/change_list.png)\n\nYou can add, modify record\n\n![change_form](/images/change_form.png)\n\n\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/yueyoum/duckadmin", "keywords": "django,admin", "license": "BSD", "maintainer": null, "maintainer_email": null, "name": "duckadmin", "package_url": "https://pypi.org/project/duckadmin/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/duckadmin/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/yueyoum/duckadmin" }, "release_url": "https://pypi.org/project/duckadmin/0.2.0/", "requires_dist": null, "requires_python": null, "summary": "UNKNOWN", "version": "0.2.0" }, "last_serial": 2254854, "releases": { "0.1.2": [ { "comment_text": "", "digests": { "md5": "d9f99944046cda4fbc6205305444801e", "sha256": "6384e73d01177b7ce55668a91f21d13ec9347059bf7ba129768a8dd2d14d9efe" }, "downloads": -1, "filename": "duckadmin-0.1.2.tar.gz", "has_sig": false, "md5_digest": "d9f99944046cda4fbc6205305444801e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 7572, "upload_time": "2015-12-13T10:53:58", "url": "https://files.pythonhosted.org/packages/46/04/db15ae69acc77276e42024b014edba27506a53c5dd75224c41f044a58f81/duckadmin-0.1.2.tar.gz" } ], "0.2.0": [ { "comment_text": "", "digests": { "md5": "ff6f04d8a40626275e2a7079a4e45c93", "sha256": "914485f71541e915f25d298896444195b993cfb550e06307d3714565df9dc654" }, "downloads": -1, "filename": "duckadmin-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ff6f04d8a40626275e2a7079a4e45c93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8068, "upload_time": "2016-08-01T09:35:42", "url": "https://files.pythonhosted.org/packages/d0/10/28477a6c7b53e2d0e2d43e26c8764044b764da67a375b33e41047096bd84/duckadmin-0.2.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ff6f04d8a40626275e2a7079a4e45c93", "sha256": "914485f71541e915f25d298896444195b993cfb550e06307d3714565df9dc654" }, "downloads": -1, "filename": "duckadmin-0.2.0.tar.gz", "has_sig": false, "md5_digest": "ff6f04d8a40626275e2a7079a4e45c93", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8068, "upload_time": "2016-08-01T09:35:42", "url": "https://files.pythonhosted.org/packages/d0/10/28477a6c7b53e2d0e2d43e26c8764044b764da67a375b33e41047096bd84/duckadmin-0.2.0.tar.gz" } ] }