+ return self.find_attachment(slug, fmt).file.url
+
+ def url_for_image(self, slug, fmt, width=None):
+ try:
+ src_img = self.find_attachment(slug, fmt).file
+ except self.MaterialNotFound:
+ return ''
+ img = get_image(src_img.path, width, self.DEFAULT_IMAGE_WIDTH, self.IMAGE_FORMATS)
+ return (img or src_img).url
+
+ def text_to_anchor(self, text):
+ return slughifi(text)
+
+ def get_forma_url(self, forma):
+ return '%s#%s' % (
+ reverse('catalogue_lesson', args=['metody']),
+ self.text_to_anchor(forma)
+ )
+
+ def get_help_url(self, naglowek):
+ return '%s%s#%s' % (
+ '//edukacjamedialna.edu.pl',
+ reverse('info', args=['jak-korzystac/']),
+ self.naglowek_to_anchor(naglowek)
+ )
+
+
+class PdfFormat(EduModulePDFFormat):
+ IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF')
+ DEFAULT_IMAGE_WIDTH = 1600
+
+ def get_image(self, name):
+ src_img = super(PdfFormat, self).get_image(name)
+ img = get_image(
+ src_img.get_filename(),
+ default_width=self.DEFAULT_IMAGE_WIDTH,
+ formats=self.IMAGE_FORMATS)
+ if img:
+ return IOFile.from_filename(img.storage.path(img))
+ else:
+ return src_img
+
+
+class PdfFromHtmlFormat(EduModulePdfFromHtmlFormat):
+ IMAGE_FORMATS = ('PNG', 'JPEG', 'GIF')
+ DEFAULT_IMAGE_WIDTH = 1600
+
+ def find_attachment(self, slug, fmt):