1. Spencer Herzberg
  2. django-reporting

Commits

Spencer Herzberg  committed c8156fc

upgrading to django 1.3.1; there still is a bug on displaying verbose_name on the report list;

  • Participants
  • Parent commits 3dfe051
  • Branches master
  • Tags v.1.3.1

Comments (0)

Files changed (4)

File reporting/__init__.py

View file
         raise Exception("No such report '%s'" % slug)
 
 def all_reports():
-    return _registry.items()
-
+    return _registry
 
 def autodiscover():
     from django.conf import settings

File reporting/site.py

View file
 class ReportingSite(object):
     _registry = {}
     
-    
     def register(self, slug, klass):
         self._registry[slug] = klass
-        print self, self._registry
     
     def get_report(self, slug):
         try:
             raise Exception("No such report '%s'" % slug)
     
     def all_reports(self):
-        print self, self._registry
         return self._registry.items()
 
 
-site = ReportingSite()
+site = ReportingSite()

File reporting/templates/reporting/list.html

View file
 		<h2>Reports</h2>
       
 		<div id="changelist">
-		{% for slug, report in reports %}
-			<a href="{% url reporting-view slug %}">{{report.verbose_name}}</a><br>
-		{% endfor %}
+			{% for slug, report in reports.items %}
+				<a href="{% url reporting-view slug %}">{{ slug }}</a><br>
+			{% endfor %}
 		</div>
-    	</div>
+
+	</div>
 </div>
 {% endblock %}

File reporting/views.py

View file
-from django.shortcuts import render_to_response
+from django.shortcuts import render
 from django.template.context import RequestContext
+from django.template import Context, Template
 import reporting
 
 def report_list(request):
     reports = reporting.all_reports()
-    return render_to_response('reporting/list.html', {'reports': reports}, 
-                              context_instance=RequestContext(request))
+    context = {'reports': reports}
+    
+    return render(request, 'reporting/list.html', context)
 
 def view_report(request, slug):
     report = reporting.get_report(slug)(request)
     data = {'report': report, 'title':report.verbose_name}
-    return render_to_response('reporting/view.html', data, 
-                              context_instance=RequestContext(request))
+   
+    return render(request, 'reporting/view.html', data)