add materials to lesson pack
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 18 Feb 2013 12:25:41 +0000 (13:25 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Mon, 18 Feb 2013 12:25:41 +0000 (13:25 +0100)
catalogue/models.py

index d052d67..c684ab5 100644 (file)
@@ -180,6 +180,10 @@ class Lesson(models.Model):
         if pdf:
             zipf.write(pdf.path, 
                 "%s%s%s.pdf" % (prefix, self.slug, "_student" if student else ""))
         if pdf:
             zipf.write(pdf.path, 
                 "%s%s%s.pdf" % (prefix, self.slug, "_student" if student else ""))
+        for attachment in self.attachment_set.all():
+            zipf.write(attachment.file.path,
+                u"%smaterialy/%s.%s" % (prefix, attachment.slug, attachment.ext))
+            
         
 
     def build_package(self, student=False):
         
 
     def build_package(self, student=False):