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
Metadata
Release files for apidev-coop-colorbox 1.6.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| apidev-coop_colorbox-1.6.0.tar.gz | 52.5 kB | Without provenance | Details for apidev-coop_colorbox-1.6.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| apidev_coop_colorbox-1.6.0-py3-none-any.whl | Python 3 | none | any | Details for apidev_coop_colorbox-1.6.0-py3-none-any.whl |
Total release size: 121.8 kB
Release files / apidev-coop_colorbox-1.6.0.tar.gz
| Download URL | apidev-coop_colorbox-1.6.0.tar.gz |
|---|---|
| Size | 52.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
230468108369dfadf365223c939e5dba537c39d193ead7da424b0084beeaba83
|
|
BLAKE2b-256 checksum How to use checksums |
466227195d0d7a5b2cb9f06cbaab2d6ebff62c1a5b604296b538351300e0881c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Release files / apidev_coop_colorbox-1.6.0-py3-none-any.whl
| Download URL | apidev_coop_colorbox-1.6.0-py3-none-any.whl |
|---|---|
| Size | 69.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eb74b193057b4a4469d348a41ceedd1d7a505175e6e1fee86b314d2f528c7037
|
|
BLAKE2b-256 checksum How to use checksums |
718c7ccc1da76991fa89f4a7cf95c34495c5a1d1d1fb7bbab464d0dd38a54ca4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.9
|
Security for apidev-coop-colorbox 1.6.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.