1. boblefrag
  2. eggDiscover

Commits

yoha...@gabory.fr  committed 1bc8747

created a new url : complete to retreive csv without paginate, modified csv render to accept something else than a StringIO (a file for exemple)

  • Participants
  • Parent commits c84287d
  • Branches default

Comments (0)

Files changed (2)

File followerslookup/urls.py

View file
  • Ignore whitespace
     url(r'^howto/$',TemplateView.as_view(template_name="how-to.html")),
     url(r'^lookup/(?P<user>\w+)/$',
         CsvGenericListView.as_view(model = User,paginate_by=100)),
+    url(r'^lookup/complete/(?P<user>\w+)/$',
+        CsvGenericListView.as_view(model = User),{'complete':True}),
     url(r'^lookup/$',CsvGenericListView.as_view(model = User,paginate_by=100))
     )
 

File followerslookup/views.py

View file
  • Ignore whitespace
                             **httpresponse_kwargs)
         resp['Content-Disposition'] = 'attachment; filename=users.csv'
         return resp
-    def convert_context_to_csv(self, context):
-        csv_file = StringIO()
+    def convert_context_to_csv(self, context, csv_file = StringIO()):
         writer = csv.writer(csv_file)
         writer.writerow(User._meta.get_all_field_names())
         for obj in context["object_list"]: