I have the following code and an error that says 'inconsistent use of spaces and indentation' but I cannot see what has been done wrong?
class Song(models.Model):
album=models.ForeignKey(Album, on_delete=models.CASCADE)
file_type=models.CharField(max_length=10)
song_title=models.CharField(max_length=250)
def __str__(self):
return self.song_title
The code above it for another class is exactly the same, but it works
class Album(models.Model):
artist=models.CharField(max_length=250)
album_title=models.CharField(max_length=500)
genre=models.CharField(max_length=100)
album_logo=models.CharField(max_length=1000)
def __str__(self): #this is a string representation of this object - useful for testing/viewing purposes
return self.album_title+""+self.artist
The error appears to be in the line that returns the string representation of the Song object
def __str__(self):
return self.song_title
More specifically the error seems to point to this line:
def __str__(self): (if you note its position above int he Song class, the indentation looks fine...)
Can anyone spot the error or suggest a fix?
tab to spacesconversion feature.