'str' object has no attribute 'field'

, this is my html page

{% extends 'base.html' %}
{% block title %} my todo{% endblock title %}
{% block container %}
<link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
{% load static %}
<link rel="stylesheet" href="{%static 'css/styles.css'%}">

<body class="or">


        <!--{{ form.as_p }}-->
          <!--  <div class="inputcon">
                <input type="text" id="TITLE" class="Title" name="TITle" required>

            <label for ="TITLE">Title</label>
            </div>-->
            {% load widget_tweaks %}
            <div django-app="Taskmanager">
                <div class="container">
                    <div class="content">
                        <h1>TODOAPP</h1>
        <p class="tagline"> a Django todo app</p>
        <form class="horizon" action="{% url 'new_todo' %}" method="POST" class="form-horizontal">
        {% csrf_token %}

             <div class="raw">
                  <label>Name :</label>
                 {% render_field form.name type="name" class="taged" title="user name" %}

             </div>
              
            
               {% render_field form.description rows="10" cols="40" title="what do you need to do!" %}
               {% render_field form.time_added type="date" %}
               {% render_field form.due_date type="date" %}





            <div class="row">
                <button class="Add" name="addtask" type="submit">
                    <i class="fa fa-plus icon"></i>ADD TASK
                </button>
                <button class="taskdel" name="Delete" formnovalidate="" type="submit" onclick="$('input').click();"><i class="fa fa-trash-o icon"></i>Delete Tasks</button>
            </div>

             <ul class="taskList">
            {% for todo in todos %} <!-- django template lang - for loop -->
                <li class="taskItem">
                    <input type="checkbox" class="taskCheckbox" name="checkedbox" id="{{ todo.id }}" value="{{ todo.id }}">
                    <label for="{{ todo.id }}"><span class="complete-">{{ todo.title }}</span></label>

                    <strong class="taskDate"><i class="fa fa-calendar"></i>{{ todo.created }} - {{ todo.due_date }}</strong>
                </li>
            {% endfor %}
            </ul>
        </form>
                        </div>
 </div>
</div>



</body>
{% endblock container %}
 AND THIS IS MY VIEWS
def new_todo(request):
    todos = TodoApp.objects.all()
    if request.method == 'POST':
        if "taskadd" in request. POST:
            name = request.POST["name"]
            description = request.POST["description"]
            date = str(request.POST["date"])
            content = name + "--" + date +" " + description
            Todo = TodoApp(name=name, content=content, due_date=date, description=description)
            Todo.save()
            return redirect("/")

        if "taskDelete" in request.POST:
            checkedlist = request.POST["checkedbox"]
            for todo_id in checkedlist:
                todo = TodoApp.objects.get(id=int(todo_id))
                todo.delete()
            return redirect("/")


    return render(request, 'apptodo/new_todo.html', {'todos': todos})

BUT I KEPT GETTING ‘STR’ OBJECT HAS NO ATTRIBUTE FIELD

Hi there, can you give more information on your project? Like what kind of packages you are using?

But based on your error that there is no attribute field, it sounds like there is some issue with your if statement

        if "taskadd" in request. POST:

There appears to be an extra space. But if that is not it, I would suspect the issue in within that if statement as there are lots of method/attribute calls there.