+ user_can_publish = (
+ request.user.is_authenticated and
+ request.user.oauthconnection_set.filter(access=True).exists())
+
+ alerts = []
+ parts_count = audiobook.parts_count
+ if parts_count > 1:
+ series = models.Audiobook.objects.filter(slug=audiobook.slug)
+ if not audiobook.index:
+ alerts.append(_('There is more than one part, but index is not set.'))
+ if set(series.values_list('index', flat=True)) != set(range(1, parts_count + 1)):
+ alerts.append(_('Part indexes are not 1..%(parts_count)d.') % {"parts_count": parts_count})
+