1
쿼리 세트에서 비디오 요소를 가져 오려고하는데 검색하는 데 문제가 있습니다.장고 쿼리 세트에서 항목을 검색하는 방법은 무엇입니까?
user_channel = Everything.objects.filter(profile = request.user, playlist = 'Channel')
print user_channel[0] #returns the first result without error
print user_channel[0]['video'] #returns error
Models.py :
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)
당신이'user_channel [0] .video' 시도해 봤어 필터를 기반으로 동영상이 당신이 얻을 목록을보십시오 사용할 수 있습니까? – Matthias
방금 해보았습니다. 작동합니다. – sharataka