how to use custom form to upload to a model form in django code example
Example 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()
Example 2: django model form
class YourForm(ModelForm):
class Meta:
model = YourModel
fields = ['pub_date', 'headline', 'content', 'reporter']