Package: unpoly-django
django-unpolyWhat it doesunpolyis a reusable app forDjangoimplementing a Django-flavoredUnpoly v2 Server Protocol.It provides:A middleware which addsis_unpolyunpoly_target, andunpoly_validatemethods to the request object.A view mixin classes support bothDjango Generic ViewsandVanilla Views.A Form mixin class forCrispy Forms.Installationpip install unpoly_djangoConfigurationYou need to addunpoly.middleware.UnpolyMiddlewareto yourMIDDLEWARE.To install all the middleware, you want something like:MIDDLEWARE=(# ...'unpoly.middleware.UnpolyMiddleware',# ...)SettingsIf using the View mixins following constants to settings.py:MAIN_UP_TARGET='#your_main_up_target'MAIN_UP_FAIL_TARGET='#your_main_upfail_target'DEFAULT_UP_ERROR_TEMPLATE='your-unpoly-error-template.html'# Default Templates for various Unpoly layers.# Override on individual View attributes.UNPOLY_MODAL_TEMPLATE='your-unpoly-modal-template.html'UNPOLY_DRAWER_TEMPLATE='your-unpoly-drawer-template.html'UNPOLY_POPUP_TEMPLATE='your-unpoly-popup-template.html'UNPOLY_COVER_TEMPLATE='your-unpoly-cover-template.html'# Routing URL kwarg set when an optimized response is to be sentOPTIMIZED_SUCCESS_RESPONSE='optimized_success_response'DEFAULT_ERROR_VIEW='appname:error_view_name'CSRF TokenEnsure that thecsrf_tokenmeta tag is included in the head section of your templates<metaname="csrf-token"content="{{ csrf_token }}"/>View MixinsView mixin classes add hooks and properties for sending optimized server
responses to the frontend.Add view mixin classes to Django's Generic views, or Vanilla Views:fromdjango.views.genericimportFormView,TemplateViewfromunpoly.viewsimportUnpolyViewMixin,UnpolyFormViewMixin,UnpolyCrispyFormViewMixinclassYourTemplateView(UnpolyViewMixin,TemplateView):passclassYourFormView(UnpolyViewMixin,FormView):passclassYourCrispyFormView(UnpolyCrispyFormViewMixin,FormView):passCrispy Form MixinThe Crispy Form mixin can be used when form mixins are used, which enables passingup-target,up-layer,up-fail-layerandup-fail-targetparams from views to forms:fromdjango.formsimportModelFormfromunpoly.formsimportUnpolyCrispyFormMixinclassUnpolyCrispyForm(UnpolyCrispyFormMixin,ModelForm):passRunning the testsIf you have a cloned copy, run::python3 runtests.pyContributingContributions welcome! The project lives in the Github repo atthinkwelltwd/unpoly_djangorepository.Bug reports and feature requests can be filed on the repository'sissue tracker.LicenseReleased under theMIT License. There's should be aLICENSEfile in the root of the repository.The MIT License (MIT)
Copyright (c) 2021, Dave BurkholderPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.Change history for unpoly_django0.1.0
^^^^^^Initial release.