X-Git-Url: https://git.mdrn.pl/prawokultury.git/blobdiff_plain/1331b925542ab5446c6df901f249fb8b71b078a7..b64d44fd01d504fbcbf3a180f9e620fed6d527ed:/shop/models.py diff --git a/shop/models.py b/shop/models.py index 349cf43..47cace3 100644 --- a/shop/models.py +++ b/shop/models.py @@ -16,7 +16,7 @@ from . import app_settings class Offer(models.Model): """ A fundraiser for a particular book. """ - entry = models.OneToOneField(Entry) # filter publications! + entry = models.OneToOneField(Entry, models.CASCADE) # filter publications! price = models.DecimalField(_('price'), decimal_places=2, max_digits=6) cost_const = models.DecimalField(decimal_places=2, max_digits=6) cost_per_item = models.DecimalField(decimal_places=2, max_digits=6, default=0) @@ -27,7 +27,7 @@ class Offer(models.Model): ordering = ['entry'] def __unicode__(self): - return self.entry.title + return unicode(self.entry) def get_absolute_url(self): return self.entry.get_absolute_url() @@ -45,7 +45,7 @@ class Order(models.Model): The payment was completed if and only if payed_at is set. """ - offer = models.ForeignKey(Offer, verbose_name=_('offer')) + offer = models.ForeignKey(Offer, models.CASCADE, verbose_name=_('offer')) items = models.IntegerField(verbose_name=_('items'), default=1) name = models.CharField(_('name'), max_length=127, blank=True) email = models.EmailField(_('email'), db_index=True) @@ -121,4 +121,4 @@ def payment_status_changed_listener(sender, instance, old_status, new_status, ** _('New order has been placed.'), 'shop/email/payed_managers.txt' ) -getpaid.signals.payment_status_changed.connect(payment_status_changed_listener) +getpaid.signals.payment_status_changed.connect(payment_status_changed_listener, dispatch_uid='shop.models.payment_status_changed_listener')