doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__isnull=True)
else:
doc = Document.objects.get(slug__exact=slug, folder__isnull=True)
except:
doc = Document.objects.get(slug__exact=slug, islive__exact=True, folder__isnull=True)
else:
doc = Document.objects.get(slug__exact=slug, folder__isnull=True)
except: