apidev-coop-colorbox


Nameapidev-coop-colorbox JSON
Version 1.6.0 PyPI version JSON
download
home_pagehttps://github.com/ljean/coop-colorbox/
SummaryManage colorbox popup for django
upload_time2023-06-12 12:53:59
maintainer
docs_urlNone
authorLuc Jean
requires_python
licenseBSD
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            coop-colorbox, make easy to use jquery.colorbox in a django app
===============================================================


Install
=======

pip::

     pip install apidev_coop-colorbox


Settings
========

In settings.py::

    INSTALLED_APPS = (
        '...',
        'colorbox',
    )

Views
=====
views::

     from django.utils.decorators import method_decorator
     from django.http import HttpResponseRedirect, Http404

     from colorbox.decorators import popup_redirect
     class MyView(FormView):
         """edit the profile of the current user"""
         template_name = "form_popup_template.html"

         @method_decorator(popup_redirect)
         def dispatch(self, request, *args, **kwargs):
             """Manage close of the colorbox popup"""
             self.user = request.user
             return super(EditProfileView, self).dispatch(request, *args, **kwargs)

         def get_form_class(self):
             """returns the form class to use"""
             return MyForm

         def form_valid(self, form):
             form.save()
             return HttpResponseRedirect(reverse(’next_step'))

form_popup_template
===================
template::

     {% extends "colorbox/popup_form_base.html" %}
     {% load i18n %}
     {% block title %}{% trans "Edit" %}{% endblock %}
     {% block form_url %}{% url 'my_view' %}{% endblock %}

You can also overrides or extends `{% block form_intro %}` {% block form_fields %}` `{% block popup_buttons %}`
or `{% block extra_head %}`

main template
=============
template::

     {% load static i18n %}
     <script type="text/javascript" charset="utf-8" src="{% static 'js/jquery.colorbox-min.js' %}"></script>
     <script type="text/javascript" charset="utf-8" src="{% static 'js/jquery.form.js' %}"></script>
     <script type="text/javascript" src="{% static 'js/colorbox.coop.js' %}"></script>
     <link rel="stylesheet" href="{% static 'css/colorbox.css' %}" type="text/css" />
     <script>
       $(function () {
         // activate popups
         $("a.colorbox-form").colorboxify();
       });
     </script>
     <a class="colorbox-form" href="{% url 'my_view' %}">{% trans "Edit" %}</a>


In tests
========
tests::

     from colorbox.utils import assert_popup_redirects
     assert_popup_redirects(response, reverse('my_view'))


License
=======

coop-colorbox uses the BSD license see license.txt

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/ljean/coop-colorbox/",
    "name": "apidev-coop-colorbox",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "",
    "author": "Luc Jean",
    "author_email": "ljean@apidev.fr",
    "download_url": "https://files.pythonhosted.org/packages/46/62/27195d0d7a5b2cb9f06cbaab2d6ebff62c1a5b604296b538351300e0881c/apidev-coop_colorbox-1.6.0.tar.gz",
    "platform": null,
    "description": "coop-colorbox, make easy to use jquery.colorbox in a django app\n===============================================================\n\n\nInstall\n=======\n\npip::\n\n     pip install apidev_coop-colorbox\n\n\nSettings\n========\n\nIn settings.py::\n\n    INSTALLED_APPS = (\n        '...',\n        'colorbox',\n    )\n\nViews\n=====\nviews::\n\n     from django.utils.decorators import method_decorator\n     from django.http import HttpResponseRedirect, Http404\n\n     from colorbox.decorators import popup_redirect\n     class MyView(FormView):\n         \"\"\"edit the profile of the current user\"\"\"\n         template_name = \"form_popup_template.html\"\n\n         @method_decorator(popup_redirect)\n         def dispatch(self, request, *args, **kwargs):\n             \"\"\"Manage close of the colorbox popup\"\"\"\n             self.user = request.user\n             return super(EditProfileView, self).dispatch(request, *args, **kwargs)\n\n         def get_form_class(self):\n             \"\"\"returns the form class to use\"\"\"\n             return MyForm\n\n         def form_valid(self, form):\n             form.save()\n             return HttpResponseRedirect(reverse(\u2019next_step'))\n\nform_popup_template\n===================\ntemplate::\n\n     {% extends \"colorbox/popup_form_base.html\" %}\n     {% load i18n %}\n     {% block title %}{% trans \"Edit\" %}{% endblock %}\n     {% block form_url %}{% url 'my_view' %}{% endblock %}\n\nYou can also overrides or extends `{% block form_intro %}` {% block form_fields %}` `{% block popup_buttons %}`\nor `{% block extra_head %}`\n\nmain template\n=============\ntemplate::\n\n     {% load static i18n %}\n     <script type=\"text/javascript\" charset=\"utf-8\" src=\"{% static 'js/jquery.colorbox-min.js' %}\"></script>\n     <script type=\"text/javascript\" charset=\"utf-8\" src=\"{% static 'js/jquery.form.js' %}\"></script>\n     <script type=\"text/javascript\" src=\"{% static 'js/colorbox.coop.js' %}\"></script>\n     <link rel=\"stylesheet\" href=\"{% static 'css/colorbox.css' %}\" type=\"text/css\" />\n     <script>\n       $(function () {\n         // activate popups\n         $(\"a.colorbox-form\").colorboxify();\n       });\n     </script>\n     <a class=\"colorbox-form\" href=\"{% url 'my_view' %}\">{% trans \"Edit\" %}</a>\n\n\nIn tests\n========\ntests::\n\n     from colorbox.utils import assert_popup_redirects\n     assert_popup_redirects(response, reverse('my_view'))\n\n\nLicense\n=======\n\ncoop-colorbox uses the BSD license see license.txt\n",
    "bugtrack_url": null,
    "license": "BSD",
    "summary": "Manage colorbox popup for django",
    "version": "1.6.0",
    "project_urls": {
        "Download": "https://github.com/ljean/coop-colorbox/tarball/master",
        "Homepage": "https://github.com/ljean/coop-colorbox/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "718c7ccc1da76991fa89f4a7cf95c34495c5a1d1d1fb7bbab464d0dd38a54ca4",
                "md5": "18fb7c1951a3f197da4c333faebf6d9d",
                "sha256": "eb74b193057b4a4469d348a41ceedd1d7a505175e6e1fee86b314d2f528c7037"
            },
            "downloads": -1,
            "filename": "apidev_coop_colorbox-1.6.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "18fb7c1951a3f197da4c333faebf6d9d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 69240,
            "upload_time": "2023-06-12T12:53:57",
            "upload_time_iso_8601": "2023-06-12T12:53:57.930295Z",
            "url": "https://files.pythonhosted.org/packages/71/8c/7ccc1da76991fa89f4a7cf95c34495c5a1d1d1fb7bbab464d0dd38a54ca4/apidev_coop_colorbox-1.6.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "466227195d0d7a5b2cb9f06cbaab2d6ebff62c1a5b604296b538351300e0881c",
                "md5": "1b3b4b9836c36398e9989537973738b5",
                "sha256": "230468108369dfadf365223c939e5dba537c39d193ead7da424b0084beeaba83"
            },
            "downloads": -1,
            "filename": "apidev-coop_colorbox-1.6.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1b3b4b9836c36398e9989537973738b5",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 52549,
            "upload_time": "2023-06-12T12:53:59",
            "upload_time_iso_8601": "2023-06-12T12:53:59.652223Z",
            "url": "https://files.pythonhosted.org/packages/46/62/27195d0d7a5b2cb9f06cbaab2d6ebff62c1a5b604296b538351300e0881c/apidev-coop_colorbox-1.6.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-06-12 12:53:59",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "ljean",
    "github_project": "coop-colorbox",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "apidev-coop-colorbox"
}
        
Elapsed time: 0.26304s