'Create published public version of selected drafts.'

def handle(self, *args, **options):

    include_unpublished = options.get(u'include_unpublished')
    language = options.get(u'language')
    site = self.get_site(options.get(u'site'))
    try:
        user = get_user_model().objects.filter(is_active=True, is_staff=True, is_superuser=True)[0]
    except IndexError:
        raise CommandError(u'No    super    user    found,    create    one    using    `manage.py    createsuperuser`.')
    set_current_user(user)
    pages_published = 0
    pages_total = 0
    self.stdout.write(u'\nPublishing    public    drafts....\n')
    index = 0
    for (page, add) in publish_pages(include_unpublished, language, site):
        m = (u'*' if add else u'    ')
        self.stdout.write((u'%d. DCTB %s        %s    [%d]\n' % ((index + 1), m, force_text(page), page.id)))
        pages_total += 1
        if add:
            pages_published += 1
        index += 1
    self.stdout.write(u'\n')
    self.stdout.write((u'=' * 40))
    self.stdout.write((u'\nTotal:                    %s\n' % pages_total))
    self.stdout.write((u'Published:    %s\n' % pages_published))
