Skip to content Skip to sidebar Skip to footer

Created Ojects Are Not Shown Through Cmd Django Python

from sabin.models import Task >>> Task.objects.all() >>> t=Task(title='dhiraj') t=Task(title='dhiraj') t.save() error says when try to save T

Solution 1:

Use save(), it is a method, not an attribute.

t=Task(title="dhiraj")
t.save()

Also, before this, you must run:

>py manage.py makemigrations>py manage.py migrate

And also, to get all objects, it is Task.objects.all()

Post a Comment for "Created Ojects Are Not Shown Through Cmd Django Python"