Python 实例检查中超过了/person/最大递归深度处的递归错误__

Python 实例检查中超过了/person/最大递归深度处的递归错误__,python,django,Python,Django,我的包含标签显示“RecursionErrorat/person”/ instancecheck“错误中超出了最大递归深度 完全回溯: 模板错误: 在template/home/ohid/test\u venv/alumni/member/templates/member/person\u list.html中,第15行出现错误 my person_list.html: {% extends 'alumni/base.html' %} {% block content %} <h

我的包含标签显示“RecursionErrorat/person”/

instancecheck“错误中超出了最大递归深度

完全回溯: 模板错误: 在template/home/ohid/test\u venv/alumni/member/templates/member/person\u list.html中,第15行出现错误

my person_list.html:

{% extends 'alumni/base.html' %}

{% block content %}
    <h2>Members</h2>
    <table>

        <tr>
            <th>sl.</th>
            <th>Name and Position</th>
            <th>Photo</th>
            <th>Organisation & Address</th>
            <th>Contact</th>
        </tr>
        {% for person in persons %}
        <tr>
            <td>{{forloop.counter}}.</td>
            <td>{{person.name}}<br>
            {{person.present_position}}
</td>
            <td><a href="{% url 'member:person-list' %}">
            <img src="{{ person.photo_url|default_if_none:'#'}}" class="img-responsive">
        </a></td>
            <td>
            {{person.organization}}<br>
           {{person.address}}
            </td>
            <td>
             {{person.tele_land}}<br>
             {{person.tele_cell}}<br>
             {{person.email}}
            </td>
        </tr>
        {% endfor %}
    </table>
{% endblock %}
我的个人模型:

class Person(models.Model):    
    name = models.CharField(max_length=128)
    present_position=models.CharField(max_length=100)
    organization= models.CharField(max_length=150,blank=True)
    address = models.CharField(max_length=150, blank=True)
    tele_land = models.CharField(max_length=15,blank=True)
    tele_cell = models.CharField(max_length=15, blank=True)
    email = models.EmailField(max_length=70, blank=True, null=True, unique=True)
    photo= ResizedImageField(size=[60, 60],crop=['middle', 'center'],upload_to='persons/%Y/%m/%d/',null=True,
        blank=True,
        editable=True,
        help_text="Person Picture")    
    category = models.ForeignKey('Membership', on_delete=models.CASCADE)
    member_since = models.DateField(blank=True)
    image_height = models.PositiveIntegerField(null=True, blank=True, editable=False, default="100")
    image_width = models.PositiveIntegerField(null=True, blank=True, editable=False, default="100")

    def get_absolute_url(self):
        return reverse('member:detail', kwargs={'pk': self.pk})
我的网址:

app_name = 'member'
urlpatterns = [
    # Member
    url(r'^$', views.IndexView.as_view(), name='index'),
    url(r'^(?P<pk>[0-9]+)/$', views.DetailView.as_view(), name='detail'),
    url(r'member/add/$', views.AlbumCreate.as_view(), name='member-add'),
    url(r'^person/$', views.PersonListView.as_view(), name='person-list'),
]
My base.html:

<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}
{% load member_template_tags %}
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="{% static 'images/favicon.ico' %}">

      <title>Alumnai - {% block title %}Applied Chemistry & Chemical Engineering{% endblock %}</title>
      <!-- Bootstrap core CSS -->
    <link href="http://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="http://v4-alpha.getbootstrap.com/examples/dashboard/dashboard.css" rel="stylesheet">

  </head>

  <body>

    <nav class="navbar navbar-dark navbar-fixed-top bg-inverse">
      <button type="button" class="navbar-toggler hidden-sm-up" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Project name</a>
       <div id="navbar">
        <nav class="nav navbar-nav pull-xs-left">
            <a class="nav-item nav-link" href="#">Home</a>
            <a class="nav-item nav-link" href="#">About</a>
            <a class="nav-item nav-link" href="#">Search</a>


        </nav>
      </div>

    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            {% block sidebar_block %}
                {% get_person_list %}
            {% endblock %}
        </div>
        <div class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 main">
         {% block body_block %}{% endblock %}


        </div>
      </div>
    </div>

     <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
    <script src="http://v4-alpha.getbootstrap.com/dist/js/bootstrap.min.js"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="http://v4-alpha.getbootstrap.com/assets/js/vendor/holder.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="http://v4-alpha.getbootstrap.com/assets/js/ie10-viewport-bug-workaround.js"></script>

  </body>
</html>

{%load staticfiles%}
{%加载成员\模板\标记%}
校友-{%block title%}应用化学与化学工程{%endblock%}
切换导航
{%block侧边栏_block%}
{%get\u person\u list%}
{%endblock%}
{%block body_block%}{%endblock%}
window.jQuery | | document.write(“”)

你在这里做了一件很奇怪的事,我不知道为什么。您说您的基本模板使用了
get\u person\u list
inclusion标记,该标记呈现person\u list模板。但这是你观点的模板;因此,当您转到/register/时,Django转到视图,开始渲染person_列表模板,看到它扩展了基础模板,开始渲染,遇到模板标记,开始渲染该模板,转到基础模板。。。如你所见,这是一个无限递归


首先应该没有理由将这样的模板标记放在基础模板中,但即使这样做,包含标记也应该始终呈现其自己的模板,而不是从视图中重用现有模板。

请显示PersonList视图。class PersonListView(generic.ListView):model=Person-context\u-object\u-name='persons'请查看我对listView正确格式的更新。此处缺少一些内容。你在哪里使用包含标签?在基本模板中,你忘了发布完整的回溯是的,我明白你的意思,为包含标签制作了单独的模板。现在它的渲染,但css不工作。感谢您指出的错误,它的工作。
class PersonListView(generic.ListView):
    model = Person
    context_object_name = 'persons'
<!DOCTYPE html>
<html lang="en">
{% load staticfiles %}
{% load member_template_tags %}
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
    <meta name="description" content="">
    <meta name="author" content="">
    <link rel="icon" href="{% static 'images/favicon.ico' %}">

      <title>Alumnai - {% block title %}Applied Chemistry & Chemical Engineering{% endblock %}</title>
      <!-- Bootstrap core CSS -->
    <link href="http://v4-alpha.getbootstrap.com/dist/css/bootstrap.min.css" rel="stylesheet">

    <!-- Custom styles for this template -->
    <link href="http://v4-alpha.getbootstrap.com/examples/dashboard/dashboard.css" rel="stylesheet">

  </head>

  <body>

    <nav class="navbar navbar-dark navbar-fixed-top bg-inverse">
      <button type="button" class="navbar-toggler hidden-sm-up" data-toggle="collapse" data-target="#navbar" aria-expanded="false" aria-controls="navbar">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Project name</a>
       <div id="navbar">
        <nav class="nav navbar-nav pull-xs-left">
            <a class="nav-item nav-link" href="#">Home</a>
            <a class="nav-item nav-link" href="#">About</a>
            <a class="nav-item nav-link" href="#">Search</a>


        </nav>
      </div>

    </nav>

    <div class="container-fluid">
      <div class="row">
        <div class="col-sm-3 col-md-2 sidebar">
            {% block sidebar_block %}
                {% get_person_list %}
            {% endblock %}
        </div>
        <div class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 main">
         {% block body_block %}{% endblock %}


        </div>
      </div>
    </div>

     <!-- Bootstrap core JavaScript
    ================================================== -->
    <!-- Placed at the end of the document so the pages load faster -->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.0.0/jquery.min.js" integrity="sha384-THPy051/pYDQGanwU6poAc/hOdQxjnOEXzbT+OuUAFqNqFjL+4IGLBgCJC3ZOShY" crossorigin="anonymous"></script>
    <script>window.jQuery || document.write('<script src="../../assets/js/vendor/jquery.min.js"><\/script>')</script>
   <script src="https://cdnjs.cloudflare.com/ajax/libs/tether/1.2.0/js/tether.min.js" integrity="sha384-Plbmg8JY28KFelvJVai01l8WyZzrYWG825m+cZ0eDDS1f7d/js6ikvy1+X+guPIB" crossorigin="anonymous"></script>
    <script src="http://v4-alpha.getbootstrap.com/dist/js/bootstrap.min.js"></script>
    <!-- Just to make our placeholder images work. Don't actually copy the next line! -->
    <script src="http://v4-alpha.getbootstrap.com/assets/js/vendor/holder.min.js"></script>
    <!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
    <script src="http://v4-alpha.getbootstrap.com/assets/js/ie10-viewport-bug-workaround.js"></script>

  </body>
</html>