{ "info": { "author": "Serafeim Papastefanos", "author_email": "spapas@gmail.com", "bugtrack_url": null, "classifiers": [ "Environment :: Web Environment", "Framework :: Django", "Framework :: Django :: 1.10", "Framework :: Django :: 1.11", "Framework :: Django :: 1.8", "Framework :: Django :: 1.9", "Framework :: Django :: 2.0", "Framework :: Django :: 2.1", "Framework :: Django :: 2.2", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.6", "Topic :: Internet :: WWW/HTTP", "Topic :: Software Development :: Libraries" ], "description": "=======================\ndjango-generic-scaffold\n=======================\n\n.. image:: https://travis-ci.org/spapas/django-generic-scaffold.svg?branch=master\n :target: https://travis-ci.org/spapas/django-generic-scaffold\n \n\nWith django-generic-scaffold you can quickly create CRUD generic class based views for your models so you will have a basic CRUD interface to your models by writing only a couple of lines of extra code! The purpose of this CRUD interface is, as opposed to django-admin, to be used by users and not staff members.\n\ndjango-generic-scaffold is different from other scaffolding tools because it generates all views/url routes *on-the-fly* (by creating subclasses of normal django class-based views) and *not* by outputing python code. This way you can re-configure\nyour views anytime you wish.\n\nExample\n=======\n\nI've added an example project of using django-generic-scaffold: https://github.com/spapas/generic-scaffold-demo\n\nInstallation\n============\n\nInstall it with ``pip install django-generic-scaffold``, or if you want to use the latest version on github, try ``pip install git+https://github.com/spapas/django-generic-scaffold``.\n\nIf you want to use the template tags and the fallback templates of django-generic-scaffold, please put ``generic_scaffold`` in your ``INSTALLED_APPS`` setting. If you\ndon't need the template tags or fallback templates then no modifying of your settings is needed, just go ahead and use it!\n\nSimple usage\n============\n\nLet's say you have defined a model named ``Book`` in your ``models.py``. In your ``views.py`` or, even better in a module named ``scaffolding.py`` define a class that overrides ``CrudManager``:\n\n.. code-block:: python\n\n from generic_scaffold import CrudManager\n import models\n\n class BookCrudManager(CrudManager):\n model = models.Book\n prefix = 'books'\n\n\nNow, include the following lines to the ``urls.py`` of your application:\n\n.. code-block:: python\n\n from scaffolding import BookCrudManager # or from views import BookCrudManager depending on where you've put it\n book_crud = BookCrudManager() \n \n # [...] define your urlpatters here\n \n urlpatterns += book_crud.get_url_patterns()\n\n\nYou may now visit ``http://127.0.0.1:8000/books`` (or whatever was your ``prefix``) to get a list of your ``Book`` instances. \nThe following methods have also been created: \n\n* Create: ``http://127.0.0.1:8000/bookscreate`` \n* Detail: ``http://127.0.0.1:8000/booksdetail/`` \n* Edit: ``http://127.0.0.1:8000/booksupdate/`` \n* Delete: ``http://127.0.0.1:8000/booksdelete/`` \n\nIf you don't do anything else, the default fallback templates will be used (they are ugly and should only be used for testing). \nYou should add a template named ``app_name/testmodel_list.html`` (which is the default template for the ``ListView``) to override\nthe fallback templates - please read the next section for more info on that.\n\nThe ``prefix`` option you set to the ``BooksCrudManager`` method will just prepend this prefix to all created urls\nand can also be used to get your url names for reversing.\n\nTemplate selection\n==================\n\nThere's a bunch of fallback templates that will be used if no other template can be used instead.\nThese template are for testing purposes only and should be overriden (unless you want to\nquickly see that everything works). Now, there are two ways you can redefine your templates:\n\n* Implicitly: Just add appropriate templates depending on your app/model name (similarly to normal class-based-views), for example for ``app_name`` and ``TestModel`` you can add the following templates:\n\nFor create/update add ``app_name/testmodel_form.html``, \nfor list add ``app_name/testmodel_list.html``, \nfor detail add ``app_name/testmodel_detail.html``,\nfor delete add ``app_name/testmodel_confirm_delete.html``.\n\n* Explicitly: You can use the ``action_template_name`` configuration option to explicitly set which templates will be used for each action. The ``action`` could be ``list, detail, update, create`` or ``delete``. So to configure the detail template name to be ``foo.html`` you'll use the option ``detail_template_name = 'foo.html'``.\n\nSo, the priority of templates is:\n\n* Explicit templates (if configured)\n* Implicit templates (if found)\n* Fallback templates (as a last resort)\n\nConfiguration\n=============\n\nMost of the time, you'll need to configure three things before using ``django-generic-scaffold``: The form class used for create and update views, the access permissions for each generic class based view and the templates that each view will use. These can be configured just by settings attributes to your ``CrudManager`` class.\n\n* To configure the form class that will be used, use the option ``form_class``.\n* To set the permissions you have to set the ``permissions`` attribute to a dictionary of callables. The keys of that dictionary should be ``list, detail, update, create`` or ``delete`` while the values should be callables like ``login_required`` or ``permission_required('permission')`` etc.\n* To configure the template names explicitly, use ``action_template_name``.\n\nFor any other configuration of the generated class based views you'll need to define mixins that will be passed to the generated CBV classes as a list using the option ``action_mixins`` (again action is either ``list, detail``, etc).\n\nUsing mixins you can do whatever you want to your resulting CBV classes -- also, by forcing you to use mixins django-generic-scaffold will help you follow bet code practices (DRY).\n\nHowever, sometimes mixins are not enough and you may need to completely override the parent Views to use something else. For this, you may set the ``action_view_class`` property to your own parent class view (i.e ``list_view_class = OverridenListView``).\n\nAPI and template tags\n=====================\n\nIf you want to use the provided template tags to your templates, you'll need to add ``{% load generic_scaffold_tags %}`` near\nthe top of your template. Then you may use ``set_urls_for_scaffold`` which will output the URLs of the \nselected scaffold depending on your configuration. This tag can receive\nthree parameters: The django app name, the model name and the prefix name. You can either use\nthe combination of app name / model name or just the prefix. It will return a dictionary with all\nthe scaffolded urls for this model. For example, to get the url names for the model ``test2`` (careful you must use the internal model name so for ``Test2`` use ``test2`` ) \nbelonging to the app ``test1`` you'll use ``{% set_urls_for_scaffold \"test1\" \"test2\" as url_names %}`` and then you could use the attributes ``list,\ncreate, detail, update, delete`` of that object to reverse and get the corresponding urls, for example\nuse ``{% url url_names.list }`` to get the url for list. \n\nThere's also a similar API function named get_url_names that you can use to get the urls for your scaffolds.\n\nFor example, you can do something like:\n\n.. code-block:: python\n\n from generic_scaffold import get_url_names\n from django.core.urlresolvers import reverse\n\n names = get_url_names(prefix='test')\n list_url = reverse(names['list'])\n\n\nSample configuration\n====================\n\nA sample config that uses a different form (``TestForm``), defines different behavior using mixins for create and update and needs a logged in user for update / delete / create (but anonymous users can list and detail) is the following:\n\n.. code-block:: python\n\n from django.contrib.auth.decorators import login_required\n\n class TestCrudManager(CrudManager):\n prefix = 'test'\n model = models.TestModel\n form_class = forms.TestForm\n create_mixins = (CreateMixin, )\n update_mixins = (UpdateMixin, )\n permissions = {\n 'update': login_required,\n 'delete': login_required,\n 'create': login_required,\n }\n\nDjango/python version support\n=============================\n\nAs can be seen from tox.ini, the tests are run for Python 2.7 with Django\n1.8-1.11 and for Python 3.6 with Django 1.8-2.2, so these are the\nsupported versions. Python 3.7 should also work without problems, I just have\nPython 3.6 installed on system so I test with this version.\n\nChangelog\n=========\n\nv.0.5.4\n-------\n\n- Add Django 2.2 to tox.ini\n- Drop support for Django < 1.8\n\nv.0.5.3\n-------\n\n- Add Django 2.1 to tox.ini\n\nv.0.5.2\n-------\n\n- Upload readme to pypi\n\nv.0.5.0\n-------\n\n- Add support for Django 2\n\nv.0.4.1\n-------\n\n- Add support for Django 1.11\n\n\nv.0.4.0\n-------\n\n- Add support for Django 1.10\n- Allow overriding the parent classes of all views\n\nv.0.3.3\n-------\n\n- Fix bug with django 1.9 not containing the (url) patterns function \n\nv.0.3.2\n-------\n\n- Include templates in pip package (old version did not include them due to wrong setup.py configuration)\n\nv.0.3.1\n-------\n\n- Fix bug with '__all__' fields when adding form_class \n\nv.0.3.0\n-------\n\n- Drop support for Django 1.4 and 1.5\n- Add support for python 3 (python 3.5) for Django 1.8 and 1.9\n\nv.0.2.0\n-------\n\n- Braking changes for API and template tags\n- Add example project\n- Add support and configure tox for Django 1.9 \n- A bunch of fallback templates have been added (``generic_scaffold/{list, detail, form, confirm_delete}.html``)\n- Use API (get_url_names) for tests and add it to docs\n- Add (url) prefix as an attribute to CrudManager and fix templatetag to use it. \n- Prefix has to be unique to make API and template tags easier to use\n- Model also has to be unique\n\nv.0.1.2\n-------\n\n- Add tests and integrate with tox\n- Add some basic templates (non-empty, mainly for tests)\n\nv.0.1.1\n-------\n\n- Add template tags to get crud urls\n\nv.0.1\n-----\n\n- Initial", "description_content_type": "", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/spapas/django-generic-scaffold/", "keywords": "", "license": "MIT", "maintainer": "", "maintainer_email": "", "name": "django-generic-scaffold", "package_url": "https://pypi.org/project/django-generic-scaffold/", "platform": "", "project_url": "https://pypi.org/project/django-generic-scaffold/", "project_urls": { "Homepage": "https://github.com/spapas/django-generic-scaffold/" }, "release_url": "https://pypi.org/project/django-generic-scaffold/0.5.4/", "requires_dist": null, "requires_python": "", "summary": "Generic scaffolding for Django", "version": "0.5.4" }, "last_serial": 5187030, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "f9bf41b4cf8bcb096620aad1e7187bad", "sha256": "0a5b523dbba420be719b2cec692d6e246a9d526e87ad4c465ad72ed11a064d93" }, "downloads": -1, "filename": "django-generic-scaffold-0.1.zip", "has_sig": false, "md5_digest": "f9bf41b4cf8bcb096620aad1e7187bad", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5321, "upload_time": "2014-12-03T16:32:21", "url": "https://files.pythonhosted.org/packages/f2/36/1740e5aebfd48e14530543807ecaa6baa41441e867ee2ccb6dfa58a364b3/django-generic-scaffold-0.1.zip" } ], "0.1.1": [ { "comment_text": "", "digests": { "md5": "f9197cb348955853eaabfd080e81df92", "sha256": "bb4f04a9e006497b22c1f7cb8cb89ba1a736e4ed59db0158b94b71723863e2c9" }, "downloads": -1, "filename": "django-generic-scaffold-0.1.1.zip", "has_sig": false, "md5_digest": "f9197cb348955853eaabfd080e81df92", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8164, "upload_time": "2014-12-05T17:02:04", "url": "https://files.pythonhosted.org/packages/17/a7/9be71374ff6e5859cebbe568bcd922aea312b2f8ad33cd3eba18d35b73fe/django-generic-scaffold-0.1.1.zip" } ], "0.1.2": [ { "comment_text": "", "digests": { "md5": "2c5f88c4f216bf5975d46d0a5d7ae824", "sha256": "e850120c2b1c0c3beaba344ffb88239bf45dc53fb3c6def4e4c1ebd6c82397f2" }, "downloads": -1, "filename": "django-generic-scaffold-0.1.2.zip", "has_sig": false, "md5_digest": "2c5f88c4f216bf5975d46d0a5d7ae824", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 8911, "upload_time": "2015-07-08T10:26:24", "url": "https://files.pythonhosted.org/packages/40/bd/7736a1c8b2696b3a30d926c7ace6786439521744cbe960545e4cb595f4a6/django-generic-scaffold-0.1.2.zip" } ], "0.2.0": [], "0.3.0": [ { "comment_text": "", "digests": { "md5": "b4dcbb908e36a1295b0585c46984490c", "sha256": "bf830a9ce3bb5571bba0235d597aa568e3b37ac97c17a437b56595aa90a7e6a7" }, "downloads": -1, "filename": "django-generic-scaffold-0.3.0.zip", "has_sig": false, "md5_digest": "b4dcbb908e36a1295b0585c46984490c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11362, "upload_time": "2016-03-07T18:53:03", "url": "https://files.pythonhosted.org/packages/da/ed/c085560f6e5d8f2266263042cd3ec959b67744d5ea984acb253cdc97c182/django-generic-scaffold-0.3.0.zip" } ], "0.3.1": [ { "comment_text": "", "digests": { "md5": "969d5dafeee1690093c5feee44e9b41d", "sha256": "c53c912fdad2a8c1d40487eb487082aeec506d26d966142dba0c7040ae1a1004" }, "downloads": -1, "filename": "django-generic-scaffold-0.3.1.zip", "has_sig": false, "md5_digest": "969d5dafeee1690093c5feee44e9b41d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 11535, "upload_time": "2016-06-14T08:40:52", "url": "https://files.pythonhosted.org/packages/88/8c/f379f6ed7af328f3d4c303051b8ab4c2e1c5999cc3fbe9f54d007445c619/django-generic-scaffold-0.3.1.zip" } ], "0.3.2": [ { "comment_text": "", "digests": { "md5": "2b29b05e05e002d818dca033fa0be06e", "sha256": "3de25f0a7b8e8cc2071b84fb8e202e4d04ab5f22ef461d86480e256875d3051d" }, "downloads": -1, "filename": "django-generic-scaffold-0.3.2.zip", "has_sig": false, "md5_digest": "2b29b05e05e002d818dca033fa0be06e", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15731, "upload_time": "2016-06-14T09:10:27", "url": "https://files.pythonhosted.org/packages/5b/4a/0cdaefa5806239fc89dd691ad54fa7a886a20cb683d9e09a4848249a2324/django-generic-scaffold-0.3.2.zip" } ], "0.3.3": [ { "comment_text": "", "digests": { "md5": "24585a38c633a3c795b0e72da33d66ab", "sha256": "baa690ee42006662ac60b264b0a519260155a50a35039d8276f4afc972614c78" }, "downloads": -1, "filename": "django-generic-scaffold-0.3.3.zip", "has_sig": false, "md5_digest": "24585a38c633a3c795b0e72da33d66ab", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 15799, "upload_time": "2016-08-02T12:51:45", "url": "https://files.pythonhosted.org/packages/65/e1/e9b9c4dfb265d20108cd3c19a04595516d0ff97481f478fd86f595d9dd66/django-generic-scaffold-0.3.3.zip" } ], "0.4.0": [ { "comment_text": "", "digests": { "md5": "976de3ed829c9b882931d5c076a159a7", "sha256": "6d93458cb8e951f27c6f22d442ca8c2fc08d3cc6eb87edb700a1a7eab8c83c80" }, "downloads": -1, "filename": "django-generic-scaffold-0.4.0.tar.gz", "has_sig": false, "md5_digest": "976de3ed829c9b882931d5c076a159a7", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9937, "upload_time": "2016-10-07T12:16:19", "url": "https://files.pythonhosted.org/packages/40/7c/7d0449aca910ee0127dba6e12c73df1778052662d7377359b826672ad963/django-generic-scaffold-0.4.0.tar.gz" } ], "0.4.1": [ { "comment_text": "", "digests": { "md5": "408b42744b6f6791306397fdb50877c2", "sha256": "23d8ae57267a9a55cba97bf0408c3efec75ec1e683b97c3e53b68389e437d38a" }, "downloads": -1, "filename": "django-generic-scaffold-0.4.1.tar.gz", "has_sig": false, "md5_digest": "408b42744b6f6791306397fdb50877c2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9943, "upload_time": "2017-08-09T09:59:37", "url": "https://files.pythonhosted.org/packages/ff/fa/8ca0a6ca698b6757dd56689849519cd394877a67a6428e81b2a6ae646a24/django-generic-scaffold-0.4.1.tar.gz" } ], "0.5.0": [ { "comment_text": "", "digests": { "md5": "93eaeb7f581a52709926209527028535", "sha256": "a259223102e0f756153aacb17625a6c8e13b704fa3f79bcf11a780487afe1a3a" }, "downloads": -1, "filename": "django-generic-scaffold-0.5.0.tar.gz", "has_sig": false, "md5_digest": "93eaeb7f581a52709926209527028535", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 9972, "upload_time": "2018-01-16T22:01:53", "url": "https://files.pythonhosted.org/packages/7e/88/4c5a0addc1979ef06dabab854124cfa298ee96da58fc4101af1884f9c0f3/django-generic-scaffold-0.5.0.tar.gz" } ], "0.5.2": [ { "comment_text": "", "digests": { "md5": "01c914f25a66b9dd88d069044cb83363", "sha256": "383320f4448b39f32ac0daf7e2b2a3500c90ac56ca96776a889bbecc2a00d435" }, "downloads": -1, "filename": "django-generic-scaffold-0.5.2.tar.gz", "has_sig": false, "md5_digest": "01c914f25a66b9dd88d069044cb83363", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14060, "upload_time": "2018-01-16T22:39:55", "url": "https://files.pythonhosted.org/packages/89/84/56a8b9747e8732d49a821ee27e85250895e2211cf7b4edb2756f0f3c305f/django-generic-scaffold-0.5.2.tar.gz" } ], "0.5.4": [ { "comment_text": "", "digests": { "md5": "54e12f98e8d56249ce989f312c5a3ece", "sha256": "55abe941f6b937e6375de4496f6074fdc6af29271d42e2e46cfd922b122139e2" }, "downloads": -1, "filename": "django-generic-scaffold-0.5.4.tar.gz", "has_sig": false, "md5_digest": "54e12f98e8d56249ce989f312c5a3ece", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14451, "upload_time": "2019-04-25T09:31:31", "url": "https://files.pythonhosted.org/packages/9c/42/b0fbda757e6484b67cdba8ab16d4f575644d9f03a851c1893ed1befce0ca/django-generic-scaffold-0.5.4.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "54e12f98e8d56249ce989f312c5a3ece", "sha256": "55abe941f6b937e6375de4496f6074fdc6af29271d42e2e46cfd922b122139e2" }, "downloads": -1, "filename": "django-generic-scaffold-0.5.4.tar.gz", "has_sig": false, "md5_digest": "54e12f98e8d56249ce989f312c5a3ece", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14451, "upload_time": "2019-04-25T09:31:31", "url": "https://files.pythonhosted.org/packages/9c/42/b0fbda757e6484b67cdba8ab16d4f575644d9f03a851c1893ed1befce0ca/django-generic-scaffold-0.5.4.tar.gz" } ] }