无法在 Django 视图中发现语法错误

cant spot the syntax error in django views

大家好,我无法在我的 Django 中找到语法错​​误 views.I 我正在尝试创建一个视图,由用户借助内联表单集作为给定的代码来创建 post below.But 如果出现以下情况,视图将抛出错误:

我正在 (:)

正下方获取错误指示器
    if request.method == 'POST':
    SyntaxError: invalid syntax

我检查了缩进,但没有发现错误spot.can如果你正在阅读它,你会发现吗?

 #views.py
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.http import HttpResponseRedirect
from django.shortcuts import render
from . import forms
from .models import *
@login_required
def post(request):
    form = forms.PostForm()
    formset =forms.AnswerInlineFormSet(queryset=models.Answer.objects.none()
    if request.method == 'POST':
        form = forms.PostForm(request.POST)    
        formset=forms.ImageInlineFormSet(request.POST,request.
                              FILES,queryset=Images.objects.none())
        if form.is_valid() and formset.is_valid():
            post = form.save(commit=False)
            post.user = request.user
            post.save()
            images = formset.save(commit=False)
            for image in images:
                image.post = post
                image.save()
            messages.success(request,'Post added.')
            return HttpResponseRedirect('/feeds')
     return render(request,'usersubmit/post_create.html',{'form'= form,'formset' = formset,})    

这是视图的表单:

 #forms.py
from django import forms
from .models import Post,Images
class PostForm(forms.ModelForm):
    class Meta:
        model = Post
        fields = ('title', 'synopsis','category','tags' )


class ImageForm(forms.ModelForm):
    class Meta:
        model = Images
        fields = ('image','body', )

ImageFormset= forms.modelformset_factory(
    models.Images,
     form=ImageForm,
)       

ImageInlineFormSet = forms.inlineformset_factory(
      models.Post,
    models.Images,
    extra=2,
    fields = ('image','body', ),
    formset=ImageFormset,
    min_num=1,
)

你们可以检查我的代码吗?

需要添加)

formset =forms.AnswerInlineFormSet(queryset=models.Answer.objects.none()

formset =forms.AnswerInlineFormSet(queryset=models.Answer.objects.none())
#                                                                      ^^^