- def published(cls, audiobook):
- setattr(audiobook, "%s_published_tags" % cls.ext,
- getattr(audiobook, "%s_tags" % cls.ext))
- setattr(audiobook, "%s_tags" % cls.ext, None)
- setattr(audiobook, "%s_published" % cls.ext, datetime.now())
- cls.set_status(audiobook, None)
+ def published(cls, aid):
+ kwargs = {
+ "%s_published_tags" % cls.ext: F("%s_tags" % cls.ext),
+ "%s_tags" % cls.ext: None,
+ "%s_published" % cls.ext: datetime.now(),
+ '%s_status' % cls.ext: None,
+ }
+ Audiobook.objects.filter(pk=aid).update(**kwargs)