fnp
/
edumed.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
update results email for new test + disable new forms
[edumed.git]
/
catalogue
/
models.py
diff --git
a/catalogue/models.py
b/catalogue/models.py
index
c5ed66c
..
c73c762
100644
(file)
--- a/
catalogue/models.py
+++ b/
catalogue/models.py
@@
-239,10
+239,13
@@
class Lesson(models.Model):
pdf = PdfFormat(wldoc, teacher=True).build()
self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
pdf = PdfFormat(wldoc, teacher=True).build()
self.pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
- def build_
weasy_pdf(self
):
- from .publish import
Weasy
Format
+ def build_
pdf_from_html(self, **kwargs
):
+ from .publish import
PdfFromHtml
Format
wldoc = self.wldocument()
wldoc = self.wldocument()
- pdf = WeasyFormat(wldoc, media_root=settings.MEDIA_ROOT).build()
+ pdf = PdfFromHtmlFormat(
+ wldoc, media_root=settings.MEDIA_ROOT,
+ html_to_pdf_command=settings.HTML_TO_PDF_COMMAND,
+ **kwargs).build()
self.weasy_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
def add_to_zip(self, zipf, student=False, prefix=''):
self.weasy_pdf.save("%s.pdf" % self.slug, File(open(pdf.get_filename())))
def add_to_zip(self, zipf, student=False, prefix=''):
@@
-302,11
+305,15
@@
class Lesson(models.Model):
return any(requirement in self.dc.get('requires', []) for requirement in ('internet', 'Internet'))
return any(requirement in self.dc.get('requires', []) for requirement in ('internet', 'Internet'))
+def attachment_path(instance, filename):
+ return 'catalogue/attachment/%s/%s' % (instance.lesson.slug, filename)
+
+
class Attachment(models.Model):
slug = models.CharField(max_length=255)
ext = models.CharField(max_length=15)
lesson = models.ForeignKey(Lesson)
class Attachment(models.Model):
slug = models.CharField(max_length=255)
ext = models.CharField(max_length=15)
lesson = models.ForeignKey(Lesson)
- file = models.FileField(upload_to=
"catalogue/attachment"
, storage=bofh_storage, max_length=255)
+ file = models.FileField(upload_to=
attachment_path
, storage=bofh_storage, max_length=255)
class Meta:
ordering = ['slug', 'ext']
class Meta:
ordering = ['slug', 'ext']