Re: Need help for saving JSON object into Django Model (class object)

2018-09-05 Thread Sonali Vighne
Thanks , it works for me. there is minor changes request.data is not working, so I tried request.body and then extracted value from dict. Do you know any other way to it without using dict. if yes please , help with same. On Tuesday, September 4, 2018 at 8:29:58 PM UTC+5:30, pgopa...@gmail.com

Re: Need help for saving JSON object into Django Model (class object)

2018-09-04 Thread Sonali Vighne
Thanks I will try it. On Tuesday, September 4, 2018 at 8:29:58 PM UTC+5:30, pgopa...@gmail.com wrote: > > # Please try to use this logic in your views.py file. > # first extract the data from the request > > question_text = request.data['question_text'] > pub_date = request.data['pub_date ']

Re: Need help for saving JSON object into Django Model (class object)

2018-09-04 Thread pgopal1166
# Please try to use this logic in your views.py file. # first extract the data from the request question_text = request.data['question_text'] pub_date = request.data['pub_date '] #Then store this data in your model. Question.objects.create(question_text =question_text , pub_date = pub_date )

Re: Need help for saving JSON object into Django Model (class object)

2018-09-04 Thread RONAK JAIN
hello Sonali Please use: python manage.py makemigrations python manage.py migrate Thanks Ronak Jain On Tue, Sep 4, 2018 at 5:52 PM Sonali Vighne wrote: > Hi, > I have create a model > > Models.py > > from django.db import models > import datetime > from django.utils import timezone > > class

Need help for saving JSON object into Django Model (class object)

2018-09-04 Thread Sonali Vighne
Hi, I have create a model Models.py from django.db import models import datetime from django.utils import timezone class Question(models.Model): question_text = models.CharField(max_length=200) pub_date = models.DateTimeField('date published') def __str__(self): return self