{ "info": { "author": "Ben Tappin", "author_email": "ben@mrben.co.uk", "bugtrack_url": null, "classifiers": [ "Development Status :: 4 - Beta", "Environment :: Console", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Natural Language :: English", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Topic :: Utilities" ], "description": "django-utensils\n===============\n\nA collection of reusable components to help build Django projects.\n\nInstallation\n------------\n\nTo install the latest stable release:\n\n::\n\n pip install django-utensils\n\nTo get the latest dev version, install directly form GitHub like so:\n\n::\n\n pip install -e git://github.com/code-kitchen/django-utensils.git#egg=django-utensils\n\nMany of the template tags require the ``request`` object. You need to\nadd 'django.template.context\\_processors.request' (Django 1.6 and 17) or\n'django.template.context\\_processors.request' (Django 1.8) to the\ntemplate context processors in your settings.\n\nTo use the ``AddressedModel`` you will need to add ``countries_plus`` to\nyour ``INSTALLED_APPS`` setting.\n\nForms\n-----\n\n``SearchForm``\n~~~~~~~~~~~~~~\n\nGeneric search form that can be used on any page.\n\nUsed by ``viewmixins.SearchFormMixin``.\n\n``UniqueModelFieldsMixin``\n~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nMixin that enforces unique fields on ModelForm form fields.\n\nMust be left of ModelForm when defining the form class (see\nhttps://code.djangoproject.com/ticket/13075).\n\nThere are two ways to list your unique fields depending on whether or\nnot you want case insensitivity.\n\n.. code:: python\n\n unique_fields = ['name', 'username']\n unique_fields = ['name', {'field': 'username', 'case_insensitive': True}]\n\nMiddleware\n----------\n\nHidden site\n~~~~~~~~~~~\n\nBy adding ``utensils.middleware.HiddenSiteMiddleware`` to your\n``MIDDLEWARE_CLASSES`` you can prevent people from viewing your site\nunless they use a query string parameter. The parameter is not needed\nfor subsequent visits (unless cookies are cleared). This is a quick and\nsimple method to keep prying eyes off your staging server for example.\nProvide the parameter name in the settings variable\n``HIDDEN_SITE_SECRET``.\n\nFor example:\n\n.. code:: python\n\n MIDDLEWARE_CLASSES += ('utensils.middleware.HiddenSiteMiddleware',)\n HIDDEN_SITE_SECRET = 'whisky'\n\nUsing the built-in development server browsing to http://localhost/ will\ngive the message \"ACCESS DENIED\". Browing to http://localhost/?whisky\nwill succeed. Subsequent visits to http://localhost/ (no ``?whisky``)\nwith the same browser will succeed until cookies are cleared or the\ncookie expires (currently set to a year).\n\nView mixins\n-----------\n\nCollection of mixins for class-based views.\n\nList view pagination\n~~~~~~~~~~~~~~~~~~~~\n\nThe ``PaginateMixin`` returns the paginate by setting used by the\npagination template tag ``{% pagination %}`` so the Django ``ListView``\nfunctions can use it.\n\nYou will need to add ``utensils.context_processors.pagination`` to your\ncontext processors for the template tag to work. Set\n``settings.PAGINATION_PAGE_SIZES`` to control the page size, if not set\nthe default ``[20, 50, 100]`` is used.\n\nList view ordering\n~~~~~~~~~~~~~~~~~~\n\nThe ``OrderByMixin`` allows easy ordering of list views. By including it\nthe template tag (``{% order_by 'field_name' %}``) is given sorting\ncontext variables to work with. ``get_queryset`` is overidden to make\nuse of these and order the object list.\n\nGeneric single-field search\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThe ``SearchFormMixin`` provides a handy way to add search to list\nviews. Add the ``search_form`` manually in your template or use the\nincluded fragment ``{% include 'fragments/_search.html' %}``.\n\nSpecify the fields you wish to search on, and how, by including a\n``search_fields`` dictionary on your view like so:\n\n.. code:: python\n\n class CustomerListView(SearchFormMixin, ListView):\n model = Customer\n search_fields = {\n 'user__email': 'icontains',\n 'first_name': 'icontains',\n 'last_name': 'icontains',\n 'postal_code': 'icontains',\n }\n\n``MessageMixin``\n~~~~~~~~~~~~~~~~\n\nBy including and providing ``success_message`` and/or ``error_message``\nattributes on your view class, messages will be added automatically to\nthe request objects on events suchs as valid and invalid forms and\nformsets, object deletion etc.\n\n``PermissionRequiredMixin``\n~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\nThis mixin verfies the user is logged in and has the required\npermissions to access the view. It's a modified version of the\ndjango-braces mixin with an added bypass. Setting\n``permission_required = False`` allows you to skip the check whilst\nkeeping the mixin in a base view used across a project, for example.\n\nSettings:\n\n- ``permission_required`` - the permission to check for or False to\n skip check\n- ``login_url`` - the login url of site\n- ``redirect_field_name`` - defaults to \"next\"\n- ``raise_exception`` - defaults to False - raise 403 if set to True\n\n``RedirectToNextMixin``\n~~~~~~~~~~~~~~~~~~~~~~~\n\nIf a ``next`` query string parameter is preset on a ``post()`` call it\nis assigned to the instance ``success_url``.\n\n``StaffViewMixin``\n~~~~~~~~~~~~~~~~~~\n\nCombines ``MessageMixin``, ``RedirectToNextMixin``,\n``StaffuserRequiredMixin`` (from django-brances),\n``PermissionRequiredMixin`` to create a useful mixin that can be used on\nall staff views.\n\nViews\n-----\n\n``BaseListView``\n~~~~~~~~~~~~~~~~\n\nThis view combines the pagination, order by and search mixins and adds\nan optional query set filter description that your templates can use.\n\n.. code:: python\n\n class ActiveCustomerList(BaseListView):\n filter_description = u\"Active\"\n queryset = Customer.active.all()\n\n.. code:: html\n\n {% block content %}\n

\n {% if filter_description %}\n {{ filter_description|title }} customers\n {% else %}\n Customers\n {% endif %}\n

\n \n {% end block %}\n\nYields:\n\n.. code:: html\n\n

Active customers

\n \n\n``SetModelFieldView``\n~~~~~~~~~~~~~~~~~~~~~\n\nThis view can be used to set the value of a field on a model instance.\nGET will display a template (and should be used as a confirmation page)\nand the value will be set on POST. The view uses\n``django.views.generic.detail.BaseDetailView`` to provide\n``get_object()``.\n\n.. code:: python\n\n class CustomerInactiveView(SetModelFieldView):\n \"\"\"\n Ask the user if they're sure they want to make the customer inactive. If\n they confirm by submitting the form set is_active to False and save.\n \"\"\"\n model = Customer\n field = 'is_active'\n value = False\n template_name = \"customers/customer_inactive.html\"\n\nIf you require more control and want to introduce some logic when\nselecting the value or field to alter you can override ``get_field()``\nand ``get_value()`` instead of setting the ``field`` and ``value`` class\nattributes.\n\nStorage\n-------\n\nS3\n~~\n\nThe ``storage`` modules provides a way to easily store static or media\nfiles on Amazon S3.\n\nTo use you will need to update your ``settings`` with the appropriate\nconfiguration, something like this:\n\n.. code:: python\n\n AWS = {\n 'STATIC': {\n 'location': 'static', # AWS_LOCATION\n 'querystring_auth': False, # AWS_QUERYSTRING_AUTH\n 'default_acl': 'public-read', # AWS_DEFAULT_ACL\n },\n 'MEDIA': {\n 'location': 'media', # AWS_LOCATION\n 'querystring_auth': True, # AWS_QUERYSTRING_AUTH\n 'default_acl': 'private', # AWS_DEFAULT_ACL\n },\n }\n\n AWS_ACCESS_KEY_ID = 'XXXXXXXXXXXXXXXXXXXX'\n AWS_SECRET_ACCESS_KEY = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'\n AWS_STORAGE_BUCKET_NAME = 'bucket'\n AWS_PRELOAD_METADATA = True\n AWS_S3_SECURE_URLS = False\n\n STATICFILES_STORAGE = 'utensils.storage.StaticRootS3BotoStorage'\n DEFAULT_FILE_STORAGE = 'utensils.storage.MediaRootS3BotoStorage'\n\nMiscellaneous utils\n-------------------\n\nThere are utility functions in the ``utils`` module that deal with a\nrange of things. Some are used by other parts of the library.", "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/code-kitchen/django-utensils/", "keywords": null, "license": "The MIT License (MIT)\n\nCopyright (c) 2013 Ben Tappin\n 2013 Paul Robins\n\nPermission is hereby granted, free of charge, to any person obtaining a copy of\nthis software and associated documentation files (the \"Software\"), to deal in\nthe Software without restriction, including without limitation the rights to\nuse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\nthe Software, and to permit persons to whom the Software is furnished to do so,\nsubject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\nCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\nIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\nCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.", "maintainer": null, "maintainer_email": null, "name": "django-utensils", "package_url": "https://pypi.org/project/django-utensils/", "platform": "UNKNOWN", "project_url": "https://pypi.org/project/django-utensils/", "project_urls": { "Download": "UNKNOWN", "Homepage": "https://github.com/code-kitchen/django-utensils/" }, "release_url": "https://pypi.org/project/django-utensils/0.2/", "requires_dist": null, "requires_python": null, "summary": "Useful Django snippets.", "version": "0.2" }, "last_serial": 1758383, "releases": { "0.1": [ { "comment_text": "", "digests": { "md5": "51dc00aeb6a1d059520066226d64029d", "sha256": "aaf5825300b4b5bcd6c739158a403c8d5239bcd2b194df3aafa1a0a480499923" }, "downloads": -1, "filename": "django-utensils-0.1.tar.gz", "has_sig": false, "md5_digest": "51dc00aeb6a1d059520066226d64029d", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14682, "upload_time": "2014-08-08T09:54:58", "url": "https://files.pythonhosted.org/packages/c0/c8/5b7ce3631c675bd7697840d11f78b8603340fe49a3fba3922b4f02618899/django-utensils-0.1.tar.gz" } ], "0.2": [ { "comment_text": "", "digests": { "md5": "d0b2917888f1551974025d7bbbf81431", "sha256": "d0c07836ba19c4316b2fe2c5e35f2fa1f787b387dc57dfbf5af5f7a930862359" }, "downloads": -1, "filename": "django-utensils-0.2.tar.gz", "has_sig": false, "md5_digest": "d0b2917888f1551974025d7bbbf81431", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20369, "upload_time": "2015-10-08T13:58:37", "url": "https://files.pythonhosted.org/packages/b7/68/b81cb4f35c083d1eea85acb7ed79d0a159c60fc17b94178e065570bc6de5/django-utensils-0.2.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "d0b2917888f1551974025d7bbbf81431", "sha256": "d0c07836ba19c4316b2fe2c5e35f2fa1f787b387dc57dfbf5af5f7a930862359" }, "downloads": -1, "filename": "django-utensils-0.2.tar.gz", "has_sig": false, "md5_digest": "d0b2917888f1551974025d7bbbf81431", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20369, "upload_time": "2015-10-08T13:58:37", "url": "https://files.pythonhosted.org/packages/b7/68/b81cb4f35c083d1eea85acb7ed79d0a159c60fc17b94178e065570bc6de5/django-utensils-0.2.tar.gz" } ] }