Commits

Holly Sydney committed f72129f

White space changes, remove extra bootstrap-collapse.js (which prevents collapsibles from working).

Comments (0)

Files changed (5)

admintools_bootstrap/forms.py

 from django import forms
 
-# place form definition here
+# place form definition here

admintools_bootstrap/models.py

 from django.contrib.admin import widgets
 from django import forms
 
+
 class FilteredSelectMultiple(forms.SelectMultiple):
     """
         removing 2 select fields widget
     """
-    def __init__(self, verbose_name, is_stacked, attrs=None, choices=[]):
+    def __init__(self, verbose_name, is_stacked, attrs=None, choices=None):
+        if choices is None:
+            choices = []
         super(FilteredSelectMultiple, self).__init__(attrs, choices)
 
 widgets.FilteredSelectMultiple = FilteredSelectMultiple
 from django.contrib.admin import helpers
 from django import forms
 
+
 class Fieldset(helpers.Fieldset):
     def _media(self):
-        if 'collapse' in self.classes:
-            return forms.Media(js=['admintools_bootstrap/bootstrap/js/bootstrap-collapse.js'])
+#   collapse is included in base template now (for responsive menu)
+#        if 'collapse' in self.classes:
+#            return forms.Media(js=['admintools_bootstrap/bootstrap/js/bootstrap-collapse.js'])
         return forms.Media()
     media = property(_media)
 

admintools_bootstrap/templates/admin/base_site.html

 
 {% block extrastyle %}
 {{ block.super }}
-
 <link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}admintools_bootstrap/bootstrap/less/style.css?{% now "c" %}" />
 {#<script type="text/javascript" src="{{ STATIC_URL }}admintools_bootstrap/js/less-1.2.1.min.js"></script>#}
 {#<script type="text/javascript" src="{{ STATIC_URL }}admintools_bootstrap/js/less.js"></script>#}

admintools_bootstrap/templatetags/admintools_bootstrap.py

 
 register = template.Library()
 
+
 @register.simple_tag
 def render_dashboard_css():
     """
                     stylesheets.append('/'.join(['admintools_bootstrap', 'css', 'dashboard.css']))
             except:
                 pass
-                    
-    markup = ''    
+
+    markup = ''
     for s in stylesheets:
         markup = '%s<link rel="stylesheet" type="text/css" media="screen" href="%s%s" />\n' % (markup, settings.STATIC_URL, s)
     return markup
     else:
         return ''
 
+
 @register.simple_tag
 def atb_site_name():
     if 'django.contrib.sites' in settings.INSTALLED_APPS:
         generates page URL for given page_num, uses for prev and next links
         django numerates pages from 0
     """
-    return escape(cl.get_query_string({PAGE_VAR: page_num-1}))
+    return escape(cl.get_query_string({PAGE_VAR: page_num - 1}))
+
 
 DOT = '.'
 
-def bootstrap_paginator_number(cl,i, li_class=None):
+
+def bootstrap_paginator_number(cl, i, li_class=None):
     """
     Generates an individual page index link in a paginated list.
     """
     if i == DOT:
         return u'<li><a href="#">...</a></li>'
     elif i == cl.page_num:
-        return mark_safe(u'<li class="active"><a href="#">%d</a></li> ' % (i+1))
+        return mark_safe(u'<li class="active"><a href="#">%d</a></li> ' % (i + 1))
     else:
-        return mark_safe(u'<li><a href="%s">%d</a></li>' % (escape(cl.get_query_string({PAGE_VAR: i})), i+1))
+        return mark_safe(u'<li><a href="%s">%d</a></li>' % (escape(cl.get_query_string({PAGE_VAR: i})), i + 1))
 paginator_number = register.simple_tag(bootstrap_paginator_number)
 
 
         'page_range': page_range,
         'ALL_VAR': ALL_VAR,
         '1': 1,
-        'curr_page': cl.paginator.page(cl.page_num+1),
+        'curr_page': cl.paginator.page(cl.page_num + 1),
     }
 bootstrap_pagination = register.inclusion_tag('admin/pagination.html')(bootstrap_pagination)
 
+
 # breadcrumbs tag
 
+
 class BreadcrumbsNode(template.Node):
     """
         renders bootstrap breadcrumbs list.
         try:
             data.index('<div class="breadcrumbs">')
         except ValueError:
-            lines = [ l.strip().split(self.delimiter) for l in data.split("\n") if l.strip() ]
+            lines = [l.strip().split(self.delimiter) for l in data.split("\n") if l.strip()]
         else:
             # data is django-style breadcrumbs, parsing
             try:
                 soup = BeautifulSoup(data)
-                lines = [ (a.get('href'), a.text) for a in soup.findAll('a')]
+                lines = [(a.get('href'), a.text) for a in soup.findAll('a')]
                 lines.append([soup.find('div').text.split('&rsaquo;')[-1].strip()])
             except Exception, e:
                 lines = [["Cannot parse breadcrumbs: %s" % unicode(e)]]
         out += '</ul>'
         return out
 
+
 @register.tag(name='breadcrumbs')
 def do_breadcrumbs(parser, token):
     try:

admintools_bootstrap/urls.py

 from django.conf.urls.defaults import *
 
-# place app url patterns here
+# place app url patterns here