модели
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 не отображается в шаблоне Django?
{{form.as_p}}
форма не отображается, но если я использую LoginForm
он появляется. Что я делаю не так?
Вам необходимо наследовать вторую форму от ModelForm, пожалуйста, внимательно прочитайте документы. – mariodev
Да, извините, ребята. – pynovice