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 <sonalivighne@gmail.com> wrote:
Hi,--I have create a modelModels.pyfrom django.db import modelsimport datetimefrom django.utils import timezoneclass Question(models.Model):question_text = models.CharField(max_length=200)pub_date = models.DateTimeField('date published')def __str__(self):return self.question_textdef was_published_recently(self):return self.pub_date >= timezone.now() - datetime.timedelta(days=1)using this model table created in database. I am creating REST API . I am passing in request body{"question": { "question_text":"Some question?""pub_date":timezone.now()}}I am getting this code, but how to save that data in existing model. So that I can save that info into database.i.e. want to save above data question object.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/9fdae6df-dd1c-4229-b6eb-f8349528b1e0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BAqMUf-%2Bm6Ph13vFGQ2qGqkxKfUybAD7Q4R7X%2BE4ZVYX-wNgA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment