Trying to nail down what happens to editions tied to orphan that we delete

pull/1/head
Raymond Yee 2012-01-31 14:02:01 -08:00
parent 0924b0de9a
commit 7f2cc341d5
1 changed files with 4 additions and 0 deletions

View File

@ -10,6 +10,10 @@ class Command(BaseCommand):
print "Last 20 Works without identifiers: "
for w in models.Work.objects.filter(identifiers__isnull=True).order_by('-created')[0:20]:
print "id: %d | title: %s | created: %s" % (w.id, w.title, w.created)
# models.Work.objects.filter(identifiers__isnull=True).filter(editions__isnull=False)[0].identifiers.all()
print "Number of editions that are currently tied to Works w/o identifiers ", \
models.Work.objects.filter(identifiers__isnull=True).filter(editions__isnull=False).count()
print "Number of Identifiers not tied to Works (should be 0): ", \
models.Identifier.objects.filter(work__isnull=True).count()