Flask WTF: 'StringField' object has no attribute' content'

problem description

error
AttributeError: "StringField" object has no attribute" content"

when submitting data

the environmental background of the problems and what methods you have tried

the form form renders normally, but an error is reported after filling in the data.

related codes

/ / Please paste the code text below (do not replace the code with pictures)
Form code

class WeiboForm (FlaskForm):

"""  """
content = StringField(label=":",
                      validators=[DataRequired("")],
                      description="",
                      render_kw={"required": "required", "class": "form-controal"})
submit = SubmitField(
    label="",)


def validate_content(self,field):
    """"""
    content = field.content
    if len(content) < 5:
        raise ValidationError("5")
    if len(content) > 140:
        raise ValidationError("140")
    return content

def publish(self,user,db):
    """  """
    data=self.data
    -sharp
    weibo=Weibo(
        content=data["content"],
        user_id=user.id,
        is_valid=datetime.new(),
        created_at=datetime.new()
    )
    db.session.add(weibo)
    db.session.commit()
    return weibo

views Code
@ app.route ("/ home/weibo",methods= ["GET","POST"])
@ login_required
def weibo_publish ():

"""  """
form=WeiboForm()
if form.validate_on_submit():
    -sharp
    form.publish(user=current_user)
    -sharp
    flash("")
    -sharp
    return redirect(url_for("index"))
return render_template("/home/weibo.html",form=form)

template templates

{block content}
< div class= "contanier" >

<div class="col-md-6 col-md-offset-3">
<form class="form-weibo" role="form" method="post" action="{{ url_for("weibo_publish") }}">
    <div class="form-inner clearfix">
        <div class="form-header clearfix">
            <span class="pull-left"></span>
            <span class="pull-right">21</span>
        </div>
        {{ form.content }}
        <ul class="text-danger">
        {% for err in form.content.errors %}
        <li>{{ err }}</li>
        {% endfor %}
        </ul>
        <div class="pull-right">
        {{ form.csrf_token }}
        {{ form.submit }}
        </div>
    </div>
</form>
</div>

< / div >
{% endblock%}

what result do you expect? What is the error message actually seen?

ask the Great God for help in finding problems?

Mar.31,2021

you should post the detailed exception stack.

the problem may be this paragraph

def validate_content(self,field):
    """"""
    content = field.content

should be changed to

xxx = field.data

refer to https://wtforms.readthedocs.i.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3ab07-2c22d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3ab07-2c22d.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?