+ def build_cover(self):
+ width, height = 212, 300
+ # TODO: BookInfo shouldn't be required to build a cover.
+ info = BookInfo(rdf_attrs={}, dc_fields={
+ DCNS('creator'): [Person('Mickiewicz', 'Adam')],
+ DCNS('title'): ['Ziutek'],
+ DCNS('date'): ['1900-01-01'],
+ DCNS('publisher'): ['F'],
+ DCNS('language'): ['pol'],
+ DCNS('identifier.url'): ['test'],
+ DCNS('rights'): ['-'],
+ })
+ cover = make_cover(info, width=width, height=height)
+ out = io.BytesIO()
+ ext = cover.ext()
+ cover.save(out)
+ self.cover.save(f'{self.slug}.{ext}', out, save=False)
+ type(self).objects.filter(pk=self.pk).update(cover=self.cover)
+