2017-08-03 71 views
0

如何確定錯誤?Erro錯誤地配置DetailView Django 1.8

見我的錯誤:

ImproperlyConfigured at schedule/confirmed/c4e068dc-9e89-4fa5-9a66-cfb5ec6a306b/ 
ScheduleConfirmed is missing a QuerySet. Define ScheduleConfirmed.model, ScheduleConfirmed.queryset, or override ScheduleConfirmed.get_queryset(). 

,看到我的views.py

# views.py 
class ScheduleConfirmed(generic.DetailView): 
    modal = Schedule 
    template_name = 'schedule-confirmed.html' 

    # def get_context_data(self, **kwargs): 
    #  context = super(ScheduleConfirmed, self).get_context_data(**kwargs) 
    #  obj = self.object 
    #  return context 

我urls.py

#urls.py 
    url(r'^schedule/confirmed/(?P<pk>[^/]+)/$', views.ScheduleConfirmed.as_view(), name='schedule_confirmed'), 

我的models.py

#models.py 
class Schedule(models.Model): 
    id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False) 
    creator = models.ForeignKey(User, related_name='schedule_creator') 
    # ... 

回答

4

您的ScheduleConfirmed類屬性中存在拼寫錯誤。只需將modal更改爲model,它應該按預期工作。