'''
Created on 21-11-2011

@author: mlenart
'''
from django.core.management.base import BaseCommand
from bibmate.models import Publication
from bibmate.helpers.bibtex2html import bibtex2html

class Command(BaseCommand):
    
    args = ''
    help = 'Refresh cached bib2xhtml results.'

    def handle(self, *args, **kwargs):
        for pub in Publication.objects.all():
            pub.update_html()
            pub.save()
            print pub.id
#            bibtex = pub.get_bibtex()
#            html = bibtex2html(bibtex)
#            pub.bibtex_html = html
#            pub.save()
