def add_product(request): params = json.loads(request.POST['json']) name = params['name'] price = params['precio'] description = params['description'] date_up = datetime.now() if not name: return JsonResponse({}, status=400) product = Products() product.name = name product.description = description product.price = price product.date_up = date_up product.save() response = { 'created': True } return JsonResponse(response, status=200)