@ -21,12 +21,12 @@ def send_for_accountant(sender, instance, created, **kwargs):
@receiver(post_save, sender=Transaction)
def add_invoice_history(sender, instance,created, **kwargs):
def add_invoice_history(sender, instance, created, **kwargs):
if 'add' in instance.type:
inv_history = InvoiceHistory()
inv_history.comment = 'Пополнение счета'
inv_history.sum = instance.sum
inv_history.user = instance.user
inv_history.user = instance.customer
inv_history.save()
@ -40,7 +40,7 @@ class ScoreView(View):
return HttpResponseForbidden('403 Forbidden')
def get(self, request, *args, **kwargs):
transaction = Transaction.objects.create(customer=request.user)
transaction = Transaction.objects.get_or_create(customer=request.user, complete=False)
user_score = get_object_or_404(User.customer_objects, pk=kwargs.get('pk'))
return render(request, self.template_name, {