'Thing' object has no attribute 'uploads'


in second book, adding user-uploaded images,I got the error ‘Thing’ object has no attribute ‘uploads’,here is my code [views.py and models.py][1]

can any one help me figure out the problem ,thank you
[1]: http://stackoverflow.com/q/35764638/5678590


I got to know why:
uploads = thing.uploads.all(),should be —> uploads = Upload.objects.filter(thing=thing),it works
also another way ,
uploads = thing.uploads.all() —> uploads = thing.upload.all() ,it works


Thanks for letting us know!


actually , it is my fault,I typo the models.py in class Upload(**),thing = models.ForeignKey(Thing, related_name=“uploads”)—>thing = models.ForeignKey(Thing, related_name=“upload”),
“upload” should be “uploads”,
in fact no need to change views.py ,I have to correct the models.py ,.^ ^