X-Git-Url: https://git.mdrn.pl/edumed.git/blobdiff_plain/698b793845a58fcac88a2bd40a8b93d018549931..cf61eb00421c5f6bb1b530e1d499815bc266faac:/catalogue/models.py diff --git a/catalogue/models.py b/catalogue/models.py index 6e615a8..c684ab5 100644 --- a/catalogue/models.py +++ b/catalogue/models.py @@ -164,11 +164,12 @@ class Lesson(models.Model): wldoc = WLDocument.from_file(self.xml_file.path, provider=OrmDocProvider) else: wldoc = WLDocument(infile, provider=OrmDocProvider()) - pdf = PdfFormat(wldoc).build() if student: + pdf = PdfFormat(wldoc).build() self.student_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename()))) else: + pdf = PdfFormat(wldoc, teacher=True).build() self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename()))) @@ -177,8 +178,12 @@ class Lesson(models.Model): "%spliki-zrodlowe/%s.xml" % (prefix, self.slug)) pdf = self.student_pdf if student else self.pdf if pdf: - zipf.write(self.xml_file.path, + 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):