title: Django. Create a popup window
body: <p>In django admin we have popup windows. They do their work when we hit little green plus on some admin pages. For example when we want to create another sample of our model.</p>
  <p>My question is the following: <strong>can I utilize somehow this mechanics in order to create my own popup window when some link or button is hit?</strong> Right now a new tab opens. I would like to have a popup window.</p>
  <p>I saw a boolean option which i can render in the context, which is called is_popup. Maybe i should use it? Unfortunately when i just set it to True right now, it does not toggle a popup window. Just another tab.</p>
  <p>EDIT:
  Some code I have:</p>
  <pre><code>def apply_to_brands(modeladmin, request, queryset):
      brands = Brand.objects.all()
      mylist = list(queryset.values(&quot;id&quot;))
  
      ids = []
      for _ in mylist:
          ids.append(str(_.get('id')))
      request.session['user_ids'] = ids
      opts = modeladmin.model._meta
      app_label = opts.app_label
      data = {
          'brands': brands,
          'opts': opts,
          'change': True,
          'is_popup': False,
          'save_as': False,
          'has_delete_permission': False,
          'has_add_permission': False,
          'has_change_permission': False,
          'app_label': app_label,
      }
      return render_to_response(&quot;admin/brand/brand/brand_list.html&quot;, data)
  </code></pre>
  <p>the template:</p>
  <pre><code>{% extends &quot;admin/change_form.html&quot; %}
  {% load i18n admin_urls admin_static admin_modify %}
  {% block title %}
  Apply users to brand
  {% endblock %}
  {% block content %}
  &lt;h1&gt;Select brands&lt;/h1&gt;
  {% for brand in brands %}
  &lt;li&gt;
      &lt;a href=&quot;http://localhost/admin/user/user/{{brand.id}}/apply/&quot;&gt;{{ brand }}&lt;/a&gt;
  &lt;/li&gt;
  {% endfor %}
  {% endblock %}
  </code></pre>