I am getting an error invalid literal for int() with base 10: sharat and am not sure how to fix it. Any advice?
friend = 'sharat'
user_playlists = Everything.objects.filter(profile = friend).values('playlist').distinct()
class Everything(models.Model):
profile = models.ForeignKey(User)
playlist = models.CharField('Playlist', max_length = 2000, null=True, blank=True)
platform = models.CharField('Platform', max_length = 2000, null=True, blank=True)
video = models.CharField('VideoID', max_length = 2000, null=True, blank=True)
video_title = models.CharField('Title of Video', max_length = 2000, null=True, blank=True)
def __unicode__(self):
return u'%s %s %s %s %s' % (self.profile, self.playlist, self.platform, self.video, self.video_title)
You first need to get the user by that name and then filter by that user, rather than filtering by the username. Alternatively (and probably better), you can have Django do that itself in a more efficient way, probably involving a join: