Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class PersonForm(forms.ModelForm):
- jobs = forms.ModelMultipleChoiceField(queryset=Job.objects.all(),
- widget=forms.CheckboxSelectMultiple)
- tags = forms.ModelMultipleChoiceField(queryset=Tag.objects.all(), widget=forms.SelectMultiple)
- x = forms.FloatField(widget=forms.HiddenInput(),required=False)
- y = forms.FloatField(widget=forms.HiddenInput(),required=False)
- width = forms.FloatField(widget=forms.HiddenInput(),required=False)
- height = forms.FloatField(widget=forms.HiddenInput(),required=False)
- picture = forms.FileField(required=False)
- class Meta:
- model = Person
- fields = ['name', 'nick_name', 'birth_year', 'jobs', 'picture', 'url', 'x', 'y', 'width', 'height', ]
- widgets = {
- 'picture': forms.FileInput(attrs={
- 'accept': 'image/*' # this is not an actual validation! don't rely on that!
- })
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement