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

Question:

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')
Asked By: Destiny Franks

||

Answers:

I mis-spelt favourite
so i changed this line

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

to

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

Answered By: Destiny Franks
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.