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
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 ']
# 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 )
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
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
5 matches
Mail list logo