'the pgAdmin4 save null value
I want to save the data of the textfiled that take the location name and other filed from the html and save it in pgadmin4 by using the def in my view when I enter the value in html it is add but it shows me null in pgAdmin 
this is my view
def location(request):
if request.method == 'POST':
form = request.POST
location_id = form.get(' location_id')
location_name = form.get('location_name')
location_address = form.get('location_address')
lat = form.get('lat')
lag_y = form.get('lag_y')
user_id = request.session['user_id']
print(form)
data_insert = MapModel.objects.create(location_id=location_id,
location_name=location_name,
location_address=location_address,
lat_x=lat,
lag_y=lag_y,)
if data_insert:
json_data = {'msg': " data added succssfully",
'id': data_insert.location_id
}
return JsonResponse(json_data)
else:
json_data = {'msg': " try agine",
'id': '',
}
return JsonResponse(json_data)
else:
return render(request, 'new_file.html')
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
