]> git.parisson.com Git - teleforma.git/commitdiff
fix XLS rows
authoryomguy <yomguy@parisson.com>
Sun, 15 Apr 2012 20:48:09 +0000 (22:48 +0200)
committeryomguy <yomguy@parisson.com>
Sun, 15 Apr 2012 20:48:09 +0000 (22:48 +0200)
teleforma/htdocs/css/teleforma.css
teleforma/templates/telemeta/base.html
teleforma/views.py

index b416cc5dc07863673c7075f61705bdc149e30acf..6bfab12218e9346a05dfba366d8de9f3e19ffbfd 100644 (file)
@@ -109,7 +109,6 @@ a img { border: none; }
     margin:0px auto;
     padding-top: 0.6em;
     padding-bottom: 0.5em;
-
     }
 
 #logo a, #logo a:hover { border: none; background: transparent; }
index e93fc18d777b6bf53c9aa00fcf9da2faa8102d6b..b5b929ef5cec0da0297325189dbb27d6135d8248 100644 (file)
@@ -39,8 +39,6 @@
 <script type='text/javascript'>var CURRENT_USER_NAME=undefined;</script>
 {% endif %}
 
-<script type='text/javascript'>window.scrollTo(0, 1);</script>
-
 {% endblock %}
 
 {% block extra_javascript %}{% endblock %}
@@ -176,4 +174,5 @@ alt="logo" />
 {% endblock analytics %}
 
 </body>
+<script type='text/javascript'>window.scrollTo(0, 1);</script>
 </html>
index e7f3ad46d66b24a411e2c38fa7cc78f173223661..7212bae99581984e94a6d42398aeae3566d7ee73 100755 (executable)
@@ -193,13 +193,13 @@ class UsersTrainingView(UsersView):
 
 class UsersXLSExport(object):
 
-    first_row = 2
+    first_row = 1
 
-    def export_user(self, count, user):
+    def export_user(self, counter, user):
         student = Student.objects.filter(user=user)
         if student:
             student = Student.objects.get(user=user)
-            row = self.sheet.row(count)
+            row = self.sheet.row(counter + self.first_row)
             row.write(0, user.last_name)
             row.write(1, user.first_name)
             row.write(9, user.email)
@@ -219,8 +219,10 @@ class UsersXLSExport(object):
                 row.write(12, profile.city)
                 row.write(13, profile.telephone)
                 row.write(14, profile.date_added.strftime("%d/%m/%Y"))
-
             print 'exported: ' + user.first_name + ' ' + user.last_name + ' ' + user.username
+            return counter + 1
+        else:
+            return counter
 
     @method_decorator(permission_required('is_superuser'))
     def export(self, request):
@@ -233,7 +235,7 @@ class UsersXLSExport(object):
         row.write(3, 'FORMATION')
         row.write(4, 'PROC')
         row.write(5, 'Ecrit Spe')
-        row.write(6, unicode('Oral Spe'))
+        row.write(6, 'Oral Spe')
         row.write(7, 'ORAL 1')
         row.write(8, 'ORAL 2')
         row.write(9, 'MAIL')
@@ -242,10 +244,9 @@ class UsersXLSExport(object):
         row.write(12, 'VILLE')
         row.write(13, 'TEL')
         row.write(14, "Date d'inscription")
-        count = self.first_row
+        counter = 1
         for user in self.users:
-            self.export_user(count, user)
-            count += 1
+            counter = self.export_user(counter, user)
         response = HttpResponse(mimetype="application/vnd.ms-excel")
         response['Content-Disposition'] = 'attachment; filename=users.xls'
         self.book.save(response)