I have an app with
class Author(models.Model):
name = models.CharField(max_length=200)
and I want that when it is being started with python manage.py runserver
that the it checks if the name 'Hemingway' is already created and if not it should be created. What's the best way of doing that?
I know how to do it manually over the shell or how to create it in with forms Author.object.create(name='Hemingway')
. So, for example if I flush the database and restart my app, the name Hemingway will be created.
And in which file would that be done ?