diff --git a/apps/payment/migrations/0014_auto_20180307_0617.py b/apps/payment/migrations/0014_auto_20180307_0617.py new file mode 100644 index 00000000..ab00fdc4 --- /dev/null +++ b/apps/payment/migrations/0014_auto_20180307_0617.py @@ -0,0 +1,29 @@ +# Generated by Django 2.0.2 on 2018-03-07 06:17 + +from django.db import migrations, models +import django.utils.timezone + + +class Migration(migrations.Migration): + + dependencies = [ + ('payment', '0013_auto_20180304_1757'), + ] + + operations = [ + migrations.AlterModelOptions( + name='payment', + options={'ordering': ('created_at',), 'verbose_name': 'Платеж', 'verbose_name_plural': 'Платежи'}, + ), + migrations.AddField( + model_name='payment', + name='created_at', + field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), + preserve_default=False, + ), + migrations.AddField( + model_name='payment', + name='update_at', + field=models.DateTimeField(auto_now=True), + ), + ] diff --git a/apps/payment/models.py b/apps/payment/models.py index 7e396129..dca1a362 100644 --- a/apps/payment/models.py +++ b/apps/payment/models.py @@ -84,10 +84,13 @@ class Payment(PolymorphicModel): amount = models.DecimalField('Итого', max_digits=8, decimal_places=2, default=0, editable=False) status = models.PositiveSmallIntegerField('Статус платежа', choices=PW_STATUS_CHOICES, null=True, editable=False) data = JSONField('Данные платежа от провайдера', default={}, editable=False) + created_at = models.DateTimeField(auto_now_add=True) + update_at = models.DateTimeField(auto_now=True) class Meta: verbose_name = 'Платеж' verbose_name_plural = 'Платежи' + ordering = ('created_at',) def calc_commission(self): return self.amount * config.SERVICE_COMMISSION / 100