#69 feat(ReconciliationJar): send reconciliation jar from frontend
This commit is contained in:
@@ -2,6 +2,7 @@ from django.shortcuts import render
|
||||
from django.http import HttpResponse, HttpResponseRedirect, JsonResponse
|
||||
from django.views.generic import ListView
|
||||
from django.db import transaction
|
||||
from django.middleware.csrf import get_token
|
||||
|
||||
from .models import (
|
||||
Sale, SaleLine, Product, Customer, ProductCategory, Payment, PaymentMethods, ReconciliationJar)
|
||||
@@ -204,7 +205,12 @@ def sales_for_reconciliation(request):
|
||||
},
|
||||
'total': sale.get_total(),
|
||||
})
|
||||
return JsonResponse(grouped_sales, safe=False)
|
||||
response = JsonResponse(grouped_sales, safe=False)
|
||||
csrf_token = get_token(request)
|
||||
response['X-CSRFToken'] = csrf_token
|
||||
response['Access-Control-Allow-Headers'] = 'X-CSRFToken'
|
||||
response.set_cookie('csrftoken', csrf_token)
|
||||
return response
|
||||
|
||||
def _mask_phone(phone):
|
||||
digits = str(phone)[-3:] if phone else " " * 3
|
||||
|
||||
Reference in New Issue
Block a user