0
は同時にここに同じタイトルやカテゴリをwtih私のフォームコードでいくつかの助けをしてくださいジャンゴのModelForm
class AddVideoViaLinkForm(forms.ModelForm):
title = forms.CharField(required=True,min_length=1,max_length=200)
video_id = forms.CharField(required=True,min_length=1,max_length=20)
category = forms.CharField(required=True,min_length=1,max_length=20)
description = forms.CharField(required=True,min_length=1,max_length=20)
def clean_title(self):
title = self.cleaned_data.get('title')
if title.strip()=='':
raise forms.ValidationError('Enter a Valid Title')
else:
return title
def clean_description(self):
description = self.cleaned_data.get('description')
if description.strip()=='':
raise forms.ValidationError('Enter a Valid Description')
else:
return description
class Meta:
model = Videos
fields = ('title','video_id','category','description')