Commits

Renato Oliveira committed fa4af9b

Fix error in quantity gift.

Comments (0)

Files changed (2)

     def __unicode__(self):
         return u'{0} - {1}'.format(self.name, self.gift.name)
 
-    def save(self, *args, **kwargs):
-        super(Guest, self).save(*args, **kwargs)
-        self.gift.available_quantity -= 1
-        self.gift.save()
-
     class Meta:
         verbose_name = u'Convidado'
     if form.is_valid():
         instance = form.save()
         instance.save()
+        instance.gift.available_quantity -= 1
+        instance.gift.save()
         messages.success(request, u'Obrigado e nos vemos no casório!')
         redirect(reverse('index'))
     return render(request, 'index.html', {'form': form})