Answers for "django form class"

1

passing user instance django form submission

if form.is_valid():
    post = form.save(commit=False)
    post.author = request.user
    post.published_date = timezone.now()
    post.save()
Posted by: Guest on December-20-2020
0

django form field class

subject = forms.CharField(label='subject', max_length=100 , widget=forms.TextInput(attrs={'class': "form-control"}))
Posted by: Guest on March-12-2021

Python Answers by Framework

Browse Popular Code Answers by Language