I'm very new to python and django!
I've created a model that is syncing properly with my MySQL db instance:
class HelloWorld(models.Model):
string = models.CharField(max_length=255)
def __unicode__(self):
return "Data: " + self.string
When I launch an interactive shell with
manage.py shell
I am able to view my models records with:
import print_string
HelloWorld.objects.all()
[<HelloWorld: Data: Hello there>]
What I'd like to be able to do is modify my model thusly:
def __unicode__(self):
return "This is my data now: " + self.string
...and then view this change immediately in my interactive shell.
How do I refresh/recompile my project so subsequent calls to:
HelloWorld.objects.all()
...would then return:
[<HelloWorld: This is my data now: Hello there>]
At the moment, the only way I can see to do this is to exit the shell, restart it and import my modules again, is there a way to refresh this on-the-fly?