def template_view(modeladmin, request, form_url='', extra_context=None):
        opts = modeladmin.model._meta
        app_label = opts.app_label
        geolevel, nunits = LegislativeLevel.get_basest_geolevel_and_count()
        context = {
            # get geounits at the basest of all base geolevels
            'geounits': geolevel.geounit_set.all().order_by('portable_id').values_list('portable_id',flat=True)
        }

        resp = render_to_response("admin/%s/%s/add_template.csv" % (app_label, opts.object_name.lower()), 
            dictionary=context, mimetype='text/plain')
        resp['Content-Disposition'] = 'attachement; filename=new_subject.csv'
        return resp
Decorator which ensures the user has provided a correct user and token pair.
dataset/ETHPy150Open PublicMapping/DistrictBuilder/django/publicmapping/redistricting/admin.py/SubjectAdmin.template_view--crossover with--dataset/ETHPy150Open jpulgarin/django-tokenapi/tokenapi/decorators.py/token_required