I am testing a little management script in Django to fill a table with values from the choices list in the model. This works totally fine in my development environment but when I try it in Python Anywhere it fails with:
ob.objects.create(type=r[0])
AttributeError: 'Manager' object has no attribute 'objects'
As far as I can tell the virtualenvs at PA and my dev are the same. I am using git to sync and it thinks the code is the same.
Script below:
class Command(BaseCommand):
help = 'Create Initial Resources'
def add_arguments(self, parser):
pass
def handle(self, *args, **options):
self.stdout.write('Filling Resource Table')
out = ''
ob = Resource.objects
for r in Resource.Label_Choices:
if not ob.filter(type=r[0]):
ob.objects.create(type=r[0])
out = out + ":" + str(r[0])
else:
out = out + ":" + '*'
self.stdout.write(self.style.SUCCESS(out))