Skip to main content

Manage colorbox popup for django

Project description

coop-colorbox, make easy to use jquery.colorbox in a django app



pip install apidev_coop-colorbox






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"

    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):
        return HttpResponseRedirect(reverse(’next_step'))



{% 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


{% 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/' %}"></script>
<link rel="stylesheet" href="{% static 'css/colorbox.css' %}" type="text/css" />
  $(function () {
    // activate popups
<a class="colorbox-form" href="{% url 'my_view' %}">{% trans "Edit" %}</a>

In tests


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


coop-colorbox uses the BSD license see license.txt

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for apidev-coop_colorbox, version 1.5.1
Filename, size File type Python version Upload date Hashes
Filename, size apidev-coop_colorbox-1.5.1.tar.gz (52.6 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page