Skip to content

Instantly share code, notes, and snippets.

@dennohpeter
Created June 16, 2020 04:49
Show Gist options
  • Save dennohpeter/8cbd8ab81ecd446bde0e38d65ec0bf7b to your computer and use it in GitHub Desktop.
Save dennohpeter/8cbd8ab81ecd446bde0e38d65ec0bf7b to your computer and use it in GitHub Desktop.
Blog create
# @login_required
@staff_member_required
def blog_post_create_view(request):
form = BlogModelForm(request.POST or None, request.FILES or None)
if form.is_valid():
print(form.cleaned_data)
form = form.save(commit=False)
form.user = request.user
form.save()
template_name = "form.html"
context = {'form':form}
return render(request,template_name,context)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment