How to use updated model.py from the shell

7 views
Skip to first unread message

Betty

unread,
Mar 31, 2019, 10:46:48 AM3/31/19
to Django users
Hi all,

I am new to django and following tutorials.

I realized that even if I modified models.py while I was using shell(python manage.py shell) the modified models.py does not get recognized unless I restart the shell prompt.
Is there any other way to load my modified models.py by not restarting the shell prompt?

I appreciate any help!

Robin Riis

unread,
Mar 31, 2019, 11:07:32 AM3/31/19
to django...@googlegroups.com
Just re import and redeclare the variable?

from app import model
x = thing.objects.all()


--
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...@googlegroups.com.
To post to this group, send email to django...@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/090df280-8443-4441-96bd-3e92cb26de72%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Betty

unread,
Mar 31, 2019, 11:09:25 AM3/31/19
to Django users
Oh, thanks!


On Monday, April 1, 2019 at 12:07:32 AM UTC+9, Robin Riis wrote:
Just re import and redeclare the variable?

from app import model
x = thing.objects.all()


Den sön 31 mars 2019 16:46Betty <kbk...@gmail.com> skrev:
Hi all,

I am new to django and following tutorials.

I realized that even if I modified models.py while I was using shell(python manage.py shell) the modified models.py does not get recognized unless I restart the shell prompt.
Is there any other way to load my modified models.py by not restarting the shell prompt?

I appreciate any help!

--
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...@googlegroups.com.

Guru Murthy

unread,
Mar 31, 2019, 11:47:20 AM3/31/19
to django...@googlegroups.com
You have to update and migrate the file using makemigrations command

--
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...@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages