from django.db import models class ReportTemplate(models.Model): name = models.CharField(max_length=100) description = models.TextField(blank=True) template_file = models.FileField(upload_to='report_templates/') is_active = models.BooleanField(default=True) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) def __str__(self): return self.name class GeneratedReport(models.Model): REPORT_FORMATS = [ ('pdf', 'PDF'), ('excel', 'Excel'), ('csv', 'CSV'), ] report_template = models.ForeignKey(ReportTemplate, on_delete=models.CASCADE) name = models.CharField(max_length=200) format = models.CharField(max_length=10, choices=REPORT_FORMATS) file_path = models.CharField(max_length=500) size = models.BigIntegerField() generated_by = models.ForeignKey('accounts.User', on_delete=models.SET_NULL, null=True) generated_at = models.DateTimeField(auto_now_add=True) def __str__(self): return self.name