Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
from django.shortcuts import render
from django.http import Http404
from rest_framework.views import ApiView
from rest_framework.decorators import api_view
from rest_framework.response import Response
from rest_framework import status
from django.http import JsonResponse
from django.core import serializers
from django.conf import settings
import json
# Create your views here.
@api_view(["POST"])
def ProperWeight(heightvalue):
try:
height=json.loads(heightvalue.body)
weight=str(height*15)
return JsonResponse("Ideal weight should be:"weight+"kg" safe=False)
except ValueError as e:
return Response(e.args[0],status.HTTP_400_BAD_REQUEST)