I had a Model called Media
; it was since renamed to "PetImage" and further revised. Now ack doesn't find the string "Media" in any of my Python source files, .pyc files, my templates, or my SQLite3 database. So far as I can tell from re-examining source (and restarting Gunicorn), the string "Media" shouldn't be anywhere to be found anywhere in my project apart from e.g. stuff under CKeditor's root. I've also made and executed migrations.
But I'm still getting http://dpaste.com/0FX74SJ - Django is erroring out on a reported failure to load "Media":
Exception Value: 'module' object has no attribute 'Media'
What can I do so that Django doesn't expect the 'module' object (my models.py, I think) to provide a Media
?
The function that appears to be getting the complaint is the fourth line, with the for loop, in:
def one_pet(request, pet_id):
pet = models.Pet.objects.get(id = pet_id)
media = []
for item in models.PetImage.objects.all():
if item.url.startswith('https://youtu.be/'):
media.append('')
else:
media.append('')
return render(request, 'one_pet.html', {
'pet': pet,
'site_name': settings.SITE_NAME,
})
Is there additional bookkeeping to do if a model is renamed? What should I be doing if I want my now PetImage
to be treated as the successor to Media
and all further activity directed to PetImage
?
Thanks,