Last active
August 29, 2015 14:25
-
-
Save ShinJJang/eeb00e70f6b73388112d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import json | |
from app.models import People | |
from django.http import HttpResponse | |
def add_peoples(request, room_id): | |
# request.body = '{"peoples": [{name:'a', phone:'001010}, {....}, {....}]}' | |
json_peoples = json.loads(request.body) | |
for json_people in json_peoples["peoples"]: | |
# room is real field name. _id is attr. | |
people = People.objects.create(name=json_people['name'], phone=json_people['phone'], room_id=room_id) | |
return HttpResponse(....) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment