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.
 
 
nwhco adf73181b5 Add management commands for seeding basic and comprehensive Hadis data 11 months ago
..
README.md Add management commands for seeding basic and comprehensive Hadis data 11 months ago
__init__.py Add management commands for seeding basic and comprehensive Hadis data 11 months ago
fix_sects.py Add management commands for seeding basic and comprehensive Hadis data 11 months ago
seed_basic_data.py Add management commands for seeding basic and comprehensive Hadis data 11 months ago
seed_hadis_data.py Add management commands for seeding basic and comprehensive Hadis data 11 months ago
test_sects.py Add management commands for seeding basic and comprehensive Hadis data 11 months ago

README.md

Hadis Management Commands

seed_hadis_data

This management command seeds comprehensive data for all Hadis app models with realistic sample records while maintaining proper relationships and business domain logic.

Usage

# Basic usage - seed data with default settings
python manage.py seed_hadis_data

# Clear existing data before seeding
python manage.py seed_hadis_data --clear

# Specify custom images directory
python manage.py seed_hadis_data --images-dir /path/to/images

# Specify custom XMind file
python manage.py seed_hadis_data --xmind-file /path/to/file.xmind

# Combine options
python manage.py seed_hadis_data --clear --images-dir scripts/seed_images --xmind-file scripts/test.xmind

Options

  • --clear: Clear existing hadis data before seeding (optional)
  • --images-dir: Directory containing seed images (default: scripts/seed_images)
  • --xmind-file: Path to XMind file for categories (default: scripts/test.xmind)

What it creates

  1. HadisStatus records: Various hadis authenticity statuses (Достоверный, Хороший, etc.)
  2. HadisTag records: Topic tags for categorizing hadis
  3. HadisSect records: Shia and Sunni sects
  4. HadisCategory records: Hierarchical categories for both Quran and Hadith sources
  5. Library data: Books, categories, and collections for references
  6. Transmitters: Historical figures who transmitted hadis
  7. Hadis records: Complete hadis with translations, explanations, and relationships
  8. Transmission chains: Links between hadis and transmitters
  9. References: Book references with images

Requirements

  • The images directory must contain PNG files for book covers and reference images
  • The XMind file is optional but recommended for category mind maps
  • All models must be properly migrated before running

Performance

The command uses optimized batch operations to create data efficiently:

  • Bulk create/update operations for categories
  • Checks for existing records to avoid duplicates
  • Progress reporting for large datasets

Example Output

Starting Hadis data seeding...
Found 4 seed images
XMind file: scripts/test.xmind
Creating Hadis Statuses...
  Created status: Достоверный
  Created status: Хороший
...
Creating Hadis Categories...
  Creating categories for Шииты-двунадесятники...
    Batch created 6 Quran categories
...
Successfully seeded all Hadis data!