Creditsupdates in fotoer wdigets adn hoemapge and singe site settigns page #Run MIgration 0033 #MAJOR
This commit is contained in:
@@ -85,7 +85,16 @@ class CreditUsageLog(AccountBaseModel):
|
||||
('content', 'Content Generation'), # Legacy
|
||||
('images', 'Image Generation'), # Legacy
|
||||
]
|
||||
|
||||
|
||||
# Site relationship - stored at creation time for proper filtering
|
||||
site = models.ForeignKey(
|
||||
'igny8_core_auth.Site',
|
||||
on_delete=models.CASCADE,
|
||||
null=True,
|
||||
blank=True,
|
||||
help_text='Site where the operation was performed'
|
||||
)
|
||||
|
||||
operation_type = models.CharField(max_length=50, choices=OPERATION_TYPE_CHOICES, db_index=True)
|
||||
credits_used = models.IntegerField(validators=[MinValueValidator(0)])
|
||||
cost_usd = models.DecimalField(max_digits=10, decimal_places=4, null=True, blank=True)
|
||||
@@ -105,6 +114,8 @@ class CreditUsageLog(AccountBaseModel):
|
||||
models.Index(fields=['account', 'operation_type']),
|
||||
models.Index(fields=['account', 'created_at']),
|
||||
models.Index(fields=['account', 'operation_type', 'created_at']),
|
||||
models.Index(fields=['site', 'created_at']),
|
||||
models.Index(fields=['account', 'site', 'created_at']),
|
||||
]
|
||||
|
||||
def __str__(self):
|
||||
|
||||
Reference in New Issue
Block a user