0
詳細ページを作成するためのようにしようとしているとき:エラー、私は私のモデルに2つのクラスを持っている
from django.db import models
class nonprofit(models.Model):
organization = models.CharField(max_length=200)
city = models.CharField(max_length=200)
website = models.URLField(max_length=120, blank=True)
........
def __unicode__(self):
return self.organization
class executive(models.Model):
nonprofit = models.ForeignKey(nonprofit)
name = models.CharField(max_length=200)
title = models.CharField(max_length=200)
salary = models.PositiveIntegerField()
def __unicode__(self):
return self.name
私の見解は次のようになります。私はFieldErrorを得続ける
from django.shortcuts import render_to_response, get_object_or_404
from nonprofit.models import executive
def index(request):
executives = executive.objects.all()
return render_to_response('nonprofit/index.html', {'executives': executives})
def detail(request, id):
e = get_object_or_404(executive, d=id)
return render_to_response('nonprofit/detail.html', {'executives': e})
: キーワード 'd'をフィールドに解決できません。選択肢は:ID、名前、非営利団体、給与、役職
私は巨大なノブであり、これを修正する方法をかなり理解できません。私はdは、フィールドに等しいとき、それはフィールドにそれを解決できない理由を知っている....
ありがとう!それは本当に '幹部'ではなく、「幹部」であったはずです。ノブとして、ちょっとタイプミスが私を今殺しているだけです。 – Matt