You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
1.8 KiB
32 lines
1.8 KiB
import os
|
|
import sys
|
|
import django
|
|
|
|
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
|
|
sys.stdout.reconfigure(encoding='utf-8')
|
|
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.base')
|
|
django.setup()
|
|
|
|
from apps.hadis.models import HadisReference, InterpretationReference, BookReference, BookEdition, BookVolume
|
|
from apps.hadis.models.transmitter import OriginalTextReference
|
|
|
|
print('=== 5 SAMPLE HADIS REFERENCES ===')
|
|
for r in HadisReference.objects.select_related('book_reference', 'edition', 'book_volume')[:5]:
|
|
print(f'ID {r.id}: Book={r.book_reference_id}, Edition={r.edition_id}, BookVol={r.book_volume_id}, VolText="{r.volume}", Page="{r.pages}", HadithNo="{r.hadith_number}"')
|
|
|
|
print('\n=== 5 SAMPLE INTERPRETATION REFERENCES ===')
|
|
for r in InterpretationReference.objects.select_related('book_reference', 'edition', 'book_volume')[:5]:
|
|
print(f'ID {r.id}: Book={r.book_reference_id}, Edition={r.edition_id}, BookVol={r.book_volume_id}, VolText="{r.volume}", Page="{r.pages}", HadithNo="{r.hadith_number}"')
|
|
|
|
print('\n=== 5 SAMPLE ORIGINAL TEXT REFERENCES ===')
|
|
for r in OriginalTextReference.objects.select_related('book_reference', 'edition', 'book_volume')[:5]:
|
|
print(f'ID {r.id}: Book={r.book_reference_id}, Edition={r.edition_id}, BookVol={r.book_volume_id}, VolText="{r.volume}", Page="{r.pages}", HadithNo="{r.hadith_number}"')
|
|
|
|
# Also check how many BookEditions exist per book
|
|
print('\n=== BOOK EDITIONS AND VOLUMES INFO ===')
|
|
sample_books = BookReference.objects.all()[:5]
|
|
for b in sample_books:
|
|
ed_count = b.editions.count()
|
|
vol_count = b.volumes.count()
|
|
editions = list(b.editions.values('id', 'edition_number', 'publisher'))
|
|
print(f"Book ID {b.id} ({b.slug}): {ed_count} editions, {vol_count} volumes. Editions: {editions}")
|