if __name__ == '__main__':
    l = Location()
l.name = 'Berlin'
l.save()
locations = Location.objects.all()
print(locations)
berlin = Location.objects.filter(name='Berlin')
print(berlin)
berlin.delete()
Django script to access model objects without using manage.py shell