Skip to content

Commit

Permalink
use auto_run_add for Payment model too
Browse files Browse the repository at this point in the history
  • Loading branch information
jdungan committed Sep 6, 2016
1 parent 848c3e0 commit 0b560a1
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions auctions/models.py
Expand Up @@ -5,7 +5,6 @@
from decimal import Decimal

from datetime import datetime, timedelta
from django.utils import timezone
from django.conf import settings
from django.contrib.sites.models import Site
from django.core.urlresolvers import reverse
Expand Down Expand Up @@ -441,8 +440,8 @@ class Payment(models.Model):
max_digits=6, decimal_places=2, blank=True, default=0)
charge_id = models.CharField(max_length=255, blank=True)
refund_id = models.CharField(max_length=255, blank=True)
created = models.DateTimeField(null=True, blank=True)
modified = models.DateTimeField(null=True, blank=True, auto_now=True)
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)

class Meta:
abstract = True
Expand All @@ -451,10 +450,7 @@ def save(self, *args, **kwargs):
is_new = not self.pk
super(Payment, self).save(*args, **kwargs)
if is_new:
self.created = timezone.now()
self.add_fees()
else:
self.modified = timezone.now()
super(Payment, self).save(*args, **kwargs)

def add_fees():
Expand Down

0 comments on commit 0b560a1

Please sign in to comment.