1
모델
class VideoInfo(models.Model):
user = models.ForeignKey(User)
video_name = models.CharField(max_length=200)
director = models.CharField(max_length=200)
cameraman = models.CharField(max_length=200)
editor = models.CharField(max_length=200)
reporter = models.CharField(max_length=200)
tag = models.TextField()
형태
class LoginForm(forms.Form):
username = forms.CharField(max_length=50)
password = forms.CharField(widget=PasswordInput())
class VideoInfoForm(forms.Form):
class Meta:
model = VideoInfo
fields = ['video_type', 'director', 'cameraman', 'editor', 'reporter', 'tag']
조회수 :
class Main(View):
'''Index page of application'''
def get(self, request):
model = VideoInfo
form = VideoInfoForm()
return render_to_response('main.html', {'form':form}, context_instance=RequestContext(request))
으로 템플릿에 호출 :ModelForm이 장고 템플릿에 나타나지 않습니까?
{{form.as_p}}
형태는 게재되지 않지만, 나는 01를 사용하는 경우이 표시됩니다. 내가 도대체 뭘 잘못하고있는 겁니까?
ModelForm에서 두 번째 양식을 상속해야하므로 문서를주의 깊게 읽으십시오. – mariodev
네, 죄송합니다. – pynovice