2012-10-27 46 views
2

我試圖返回與當前相關的登錄用戶播放列表中,我得到一個錯誤說: AttributeError異常:「查詢集」對象有沒有屬性「has_header如何修復django中的AttributeError?

我已經包含了什麼,我相信是下面的代碼的相關部分。有關如何解決這個問題的任何建議?

views.py

playlist = UserPlaylist.objects.filter(profile=request.user) 
return playlist 

models.py

class UserProfile(models.Model): 
    user = models.OneToOneField(User) 
    def __unicode__(self): 
     return self.user 

def create_user_profile(sender, instance, created, **kwargs): 
    if created: 
     UserProfile.objects.create(user=instance) 

post_save.connect(create_user_profile, sender=User)   

class Playlist(models.Model): 
    playlist = models.CharField('Playlist', max_length = 2000, null=True, blank=True) 
    def __unicode__(self): 
     return self.playlist 

class Video(models.Model): 
    video_url = models.URLField('Link to video', max_length = 200, null=True, blank=True) 
    def __unicode__(self): 
     return self.video_url 

class UserPlaylist(models.Model): 
    profile = models.ForeignKey(User) 
    playlist = models.ForeignKey(Playlist) 
    def __unicode__(self): 
     return unicode(self.playlist) 

class Videoplaylist(models.Model): 
    video = models.ForeignKey(Video) 
    playlist = models.ForeignKey(UserPlaylist) 
    def __unicode__(self): 
     return unicode(self.playlist) 
+0

你可以發佈錯誤的完整追溯? –

+0

發佈全景功能。目前它的立場是錯誤的。它不會返回一個HttpResponse。 – rantanplan

回答

1

我想通了......我做的回報,而不是打印。菜鳥的錯誤。

相關問題