简体   繁体   中英

I get this Error AttributeError at /listings/5689-resot-relly-market, 'Profile' object has no attribute 'favourite' please any help would be apprciate

I'm working a add to favourite function in django and i keep getting this error when i hit the save button. everything looks fine from here that why i can't really tell where the error is coming from

Models.py

class Profile(models.Model):
    user = models.OneToOneField(User, related_name='profile', on_delete=models.CASCADE)
    ...
    favorite = models.ManyToManyField(Accomodation, related_name='profile')

I mis-spelt favourite so i changed this line

favorite = models.ManyToManyField(Accomodation, related_name='profile')

to

favourite = models.ManyToManyField(Accomodation, related_name='profile')

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM