# -*- coding: utf-8 -*-
from __future__ import unicode_literals, absolute_import
from django.conf.urls import url, include
from django.contrib import admin
from django.forms import Form
from django.http import HttpResponse
from django.template import Template, Context
from templateselector.fields import TemplateChoiceField


def example(request):
    class MyForm(Form):
        field = TemplateChoiceField(match="^admin/[0-9]+.html$")
    context = {
        'form': MyForm(request.GET or None),
    }
    template = Template("""
    <!DOCTYPE html>
    <html>
    <head>{{ form.media }}</head>
    <body>
    <form action="" method="GET">
    {{ form.media }}
    {{ form.field }}
    <input type="submit" value="Click!">
    </form>
    </body>
    </html>
    """)
    return HttpResponse(template.render(Context(context)))

urlpatterns = [
    url('^admin/', include(admin.site.urls)),
    url('^$', example),
]

import debug_toolbar
urlpatterns = [
    url(r'^__debug__/', include(debug_toolbar.urls)),
] + urlpatterns

@@ -912,17 +912,25 @@
 ple),%0A%5D%0A
-%0A
+try:%0A    
 import d
@@ -942,16 +942,20 @@
 toolbar%0A
+    
 urlpatte
@@ -962,24 +962,28 @@
 rns = %5B%0A    
+ 
+   
 url(r'%5E__deb
@@ -1020,16 +1020,20 @@
 urls)),%0A
+    
 %5D + urlp
@@ -1040,8 +1040,37 @@
 atterns%0A
+except ImportError:%0A    pass%0A

Fix up the import error if inside a fresh clone (because I need to fix the py2 build apparently)