<br />
<b>Warning</b>:  Undefined variable $auth in <b>/home/pevo0181/public_html/pia-soft.com/cleania/routes/index.php</b> on line <b>542</b><br />
<br />
<b>Warning</b>:  Trying to access array offset on value of type null in <b>/home/pevo0181/public_html/pia-soft.com/cleania/routes/index.php</b> on line <b>542</b><br />
# documents/helpers.py
import sys
from pprint import pprint
import json
from django.core.serializers import serialize

def dd(*args):
    """Dump and Die - Équivalent Laravel"""
    print("\n" + "="*60)
    print("🚨 DJANGO DD DEBUG 🚨")
    print("="*60)
    
    for i, arg in enumerate(args, 1):
        print(f"\n--- Item {i} | Type: {type(arg)} ---")
        
        # Si c'est un modèle Django
        if hasattr(arg, '_meta'):
            print(f"📄 Modèle: {arg._meta.model_name}")
            print(f"🔑 PK: {arg.pk}")
            print("\n📋 Attributs:")
            pprint(vars(arg))
            
            print("\n📊 Champs spécifiques:")
            for field in arg._meta.fields:
                field_name = field.name
                try:
                    value = getattr(arg, field_name)
                    print(f"  {field_name}: {value}")
                except Exception as e:
                    print(f"  {field_name}: ❌ {e}")
                    
        # Si c'est un queryset
        elif hasattr(arg, 'query'):
            print(f"📂 Queryset: {arg.model._meta.model_name}")
            print(f"🔍 Requête SQL: {arg.query}")
            print(f"📦 Nombre d'objets: {arg.count()}")
            print("\n📋 Premiers objets:")
            for obj in arg[:3]:  # Affiche les 3 premiers
                print(f"  - {obj}")
                
        # Si c'est un dict ou liste
        else:
            pprint(arg)
    
    print("\n" + "="*60)
    sys.exit(1)  # Arrêt