Это более или менее то, как я создаю свои почтовые запросы:
class MyPostView(View):
def post(self, request):
# Get request data
data = json.loads(request.body)
# Extract the values I need
name = data.get('name')
address = data.get('address')
# If the info already comes from the request do this
info = data.get('info')
# If you want to create the info field here do this
info = {'name':name, 'address': address}
# Create new model object
new_profile = Profile()
# Assign values
new_profile.name = name
new_profile.address = address
new_profile.info = info
# Save my object to database
new_profile.save()
# Return response (change this to whatever you want to return)
return HttpResponse("Success")
Здесь я использую представления на основе классов, но вы можете использовать представления на основе функций таким же образом. Я просто не уверен, почему вы хотите сохранить информацию для имени и адреса дважды.
Надеюсь, это поможет!