title: Django - maximum recursion depth exceeded while calling a Python object
body: <p>Error Traceback - Deleted some more or less useless paths due to character limit... </p>
  
  <pre><code>Environment:
  
  
  Request Method: GET
  Request URL: http://127.0.0.1:8000/
  
  Django Version: 3.0.6
  Python Version: 3.8.2
  Installed Applications:
  ['django.contrib.admin',
   'django.contrib.auth',
   'django.contrib.contenttypes',
   'django.contrib.sessions',
   'django.contrib.messages',
   'django.contrib.staticfiles',
   'core',
   'leads']
  Installed Middleware:
  ['django.middleware.security.SecurityMiddleware',
   'django.contrib.sessions.middleware.SessionMiddleware',
   'django.middleware.common.CommonMiddleware',
   'django.middleware.csrf.CsrfViewMiddleware',
   'django.contrib.auth.middleware.AuthenticationMiddleware',
   'django.contrib.messages.middleware.MessageMiddleware',
   'django.middleware.clickjacking.XFrameOptionsMiddleware']
  
  
  Template error:
  In template /home/radu/Documents/work/ProtocolV6/protocol/core/templates/base_generic.html, error at line 57
     maximum recursion depth exceeded while calling a Python object
     47 :       href="plugins/owl.carousel/dist/assets/owl.carousel.min.css"
     48 :     /&gt;
     49 :     &lt;link
     50 :       rel="stylesheet"
     51 :       href="plugins/owl.carousel/dist/assets/owl.theme.default.min.css"
     52 :     /&gt;
     53 :     &lt;link rel="stylesheet" href="dist/css/theme.min.css" /&gt;
     54 :   &lt;/head&gt;
     55 : 
     56 :   &lt;body&gt;
     57 :      {% include "header.html" %}  {% include "header.html" %} {% block content %}
     58 :     {% endblock %}
     59 :   &lt;/body&gt;
     60 : &lt;/html&gt;
     61 : 
  
  Traceback (most recent call last):
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 765, in __init__
      self.literal = float(var)
  
  During handling of the above exception (could not convert string to float: '"header.html"'), another exception occurred:
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 903, in render_annotated
      return self.render(context)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/loader_tags.py", line 127, in render
      compiled_parent = self.get_parent(context)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/loader_tags.py", line 124, in get_parent
      return self.find_template(parent, context)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/loader_tags.py", line 103, in find_template
      template, origin = context.template.engine.find_template(
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/engine.py", line 125, in find_template
      template = loader.get_template(name, skip=skip)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/loaders/base.py", line 29, in get_template
      return Template(
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 156, in __init__
      self.nodelist = self.compile_nodelist()
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 194, in compile_nodelist
      return parser.parse()
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 477, in parse
      raise self.error(token, e)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 475, in parse
      compiled_result = compile_func(self, token)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/loader_tags.py", line 316, in do_include
      return IncludeNode(parser.compile_filter(bits[1]), extra_context=namemap,
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 562, in compile_filter
      return FilterExpression(token, self)
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 640, in __init__
      var_obj = Variable(constant).resolve({})
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/template/base.py", line 781, in __init__
      self.literal = mark_safe(unescape_string_literal(var))
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/utils/functional.py", line 204, in wrapper
      if any(isinstance(arg, Promise) for arg in itertools.chain(args, kwargs.values())):
    File "/home/radu/.local/share/virtualenvs/ProtocolV6-LVs3tHy5/lib/python3.8/site-packages/django/utils/functional.py", line 204, in &lt;genexpr&gt;
      if any(isinstance(arg, Promise) for arg in itertools.chain(args, kwargs.values())):
  
  Exception Type: RecursionError at /
  Exception Value: maximum recursion depth exceeded while calling a Python object
  
  </code></pre>
  
  <p>Views.py</p>
  
  <pre><code>from django.shortcuts import render
  from .models import Contact
  from django.views import generic
  
  
  def index(request):
      """View function for home page of site."""
  
      # Generate counts of some of the main objects
      contacts = Contact.objects.all()
  
      context = {
          'contacts': contacts,
      }
  
      # Render the HTML template index.html with the data in the context variable
      return render(request, 'index.html', context=context)
  
  </code></pre>
  
  <p>Models</p>
  
  <pre><code>from django.db import models
  from django.urls import reverse
  #from datetime import date
  #from django.contrib.auth.models import User
  
  
  class Contact(models.Model):
      contact_title = models.CharField(max_length=50, help_text='Title')
      contact_first_name = models.CharField(max_length=50,
                                            help_text='First Name')
      contact_middle_name = models.CharField(max_length=50,
                                             help_text='Middle Name',
                                             null=True)
      contact_last_name = models.CharField(max_length=50, help_text='Last Name')
      contact_date_of_initial_contact = models.DateTimeField(auto_now_add=True,
                                                             unique=True)
      contact_company = models.CharField(max_length=200,
                                         help_text="Contact's Company",
                                         null=True)
      contact_industry = models.CharField(max_length=200,
                                          help_text="Contact's Industry",
                                          null=True)
      contact_address = models.CharField(max_length=200, help_text='Address')
      contact_address_street = models.CharField(max_length=200,
                                                help_text='Street')
      contact_address_city = models.CharField(max_length=200, help_text='City')
      contact_address_state = models.CharField(max_length=200, help_text='State')
      contact_address_zip = models.CharField(max_length=200,
                                             help_text='Zip',
                                             null=True)
      contact_address_country = models.CharField(max_length=200,
                                                 help_text='Country')
      contact_phone = models.CharField(max_length=200, help_text='State')
      contact_email = models.EmailField(unique=True)
      contact_website = models.URLField(null=True)
      contact_facebook = models.URLField(null=True)
      contact_instagram = models.URLField(null=True)
      contact_twitter = models.URLField(null=True)
      contact_linkedin = models.URLField(null=True)
      contact_github = models.URLField(null=True)
      contact_description = models.TextField(max_length=1000, null=True)
      contact_budget = models.IntegerField()
      contact_request = models.TextField(
          max_length=1000, help_text='Type here what the contact requestsed')
      contact_sales_rep = models.CharField(max_length=200,
                                           help_text='Sales Rep.')
      contact_created_on = models.DateTimeField(auto_now_add=True, unique=True)
      contact_date_of_birth = models.DateField(null=True, blank=True)
      language_name = models.CharField(max_length=200,
                                       help_text="Enter the book's natural language (e.g. English, French, Japanese etc.)", null=True)
  
      class Meta:
          ordering = ['contact_last_name', 'contact_first_name']
  
      def __str__(self):
          """String for representing the Model object."""
          return self.contact_first_name
  
      def get_absolute_url(self):
          """Returns the url to access a detail record for this book."""
          return reverse('contact-detail', args=[str(self.id)])
  
  </code></pre>
  
  <p>Base Html </p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html class="no-js" lang="en"&gt;
    &lt;head&gt;
      {% block title %}
  
      &lt;title&gt;Protocol CRM&lt;/title&gt;
  
      {% endblock %}
      &lt;meta charset="utf-8" /&gt;
      &lt;meta http-equiv="x-ua-compatible" content="ie=edge" /&gt;
      &lt;meta name="description" content="" /&gt;
      &lt;meta name="keywords" content="" /&gt;
      &lt;meta name="viewport" content="width=device-width, initial-scale=1" /&gt;
      &lt;link
        href="https://fonts.googleapis.com/css?family=Nunito+Sans:300,400,600,700,800"
        rel="stylesheet"
      /&gt;
      {% load static %}
      &lt;link rel="icon" href="favicon.ico" type="image/x-icon" /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/bootstrap/dist/css/bootstrap.min.css"
      /&gt;
      &lt;link rel="stylesheet" href="plugins/fontawesome-free/css/all.min.css" /&gt;
      &lt;link rel="stylesheet" href="plugins/icon-kit/dist/css/iconkit.min.css" /&gt;
      &lt;link rel="stylesheet" href="plugins/ionicons/dist/css/ionicons.min.css" /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/perfect-scrollbar/css/perfect-scrollbar.css"
      /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/datatables.net-bs4/css/dataTables.bootstrap4.min.css"
      /&gt;
      &lt;link rel="stylesheet" href="plugins/jvectormap/jquery-jvectormap.css" /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/tempusdominus-bootstrap-4/build/css/tempusdominus-bootstrap-4.min.css"
      /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/weather-icons/css/weather-icons.min.css"
      /&gt;
      &lt;link rel="stylesheet" href="plugins/c3/c3.min.css" /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/owl.carousel/dist/assets/owl.carousel.min.css"
      /&gt;
      &lt;link
        rel="stylesheet"
        href="plugins/owl.carousel/dist/assets/owl.theme.default.min.css"
      /&gt;
      &lt;link rel="stylesheet" href="dist/css/theme.min.css" /&gt;
    &lt;/head&gt;
  
    &lt;body&gt;
      {% include "header.html" %} {% include "header.html" %} {% block content %}
      {% endblock %}
    &lt;/body&gt;
  &lt;/html&gt;
  
  </code></pre>
  
  <p>Header Template</p>
  
  <pre><code>{% extends "base_generic.html" %} {% load static %} {% block content %}
  
  &lt;header class="header-top" header-theme="light"&gt;
    &lt;div class="container-fluid"&gt;
      &lt;div class="d-flex justify-content-between"&gt;
        &lt;div class="top-menu d-flex align-items-center"&gt;
          &lt;button type="button" class="btn-icon mobile-nav-toggle d-lg-none"&gt;
            &lt;span&gt;&lt;/span&gt;
          &lt;/button&gt;
          &lt;div class="header-search"&gt;
            &lt;div class="input-group"&gt;
              &lt;span class="input-group-addon search-close"
                &gt;&lt;i class="ik ik-x"&gt;&lt;/i
              &gt;&lt;/span&gt;
              &lt;input type="text" class="form-control" /&gt;
              &lt;span class="input-group-addon search-btn"
                &gt;&lt;i class="ik ik-search"&gt;&lt;/i
              &gt;&lt;/span&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;button type="button" id="navbar-fullscreen" class="nav-link"&gt;
            &lt;i class="ik ik-maximize"&gt;&lt;/i&gt;
          &lt;/button&gt;
        &lt;/div&gt;
        &lt;div class="top-menu d-flex align-items-center"&gt;
          &lt;div class="dropdown"&gt;
            &lt;a
              class="nav-link dropdown-toggle"
              href="#"
              id="notiDropdown"
              role="button"
              data-toggle="dropdown"
              aria-haspopup="true"
              aria-expanded="false"
              &gt;&lt;i class="ik ik-bell"&gt;&lt;/i&gt;&lt;span class="badge bg-danger"&gt;3&lt;/span&gt;&lt;/a
            &gt;
            &lt;div
              class="dropdown-menu dropdown-menu-right notification-dropdown"
              aria-labelledby="notiDropdown"
            &gt;
              &lt;h4 class="header"&gt;Notifications&lt;/h4&gt;
              &lt;div class="notifications-wrap"&gt;
                &lt;a href="#" class="media"&gt;
                  &lt;span class="d-flex"&gt;
                    &lt;i class="ik ik-check"&gt;&lt;/i&gt;
                  &lt;/span&gt;
                  &lt;span class="media-body"&gt;
                    &lt;span class="heading-font-family media-heading"
                      &gt;Invitation accepted&lt;/span
                    &gt;
                    &lt;span class="media-content"&gt;Your have been Invited ...&lt;/span&gt;
                  &lt;/span&gt;
                &lt;/a&gt;
                &lt;a href="#" class="media"&gt;
                  &lt;span class="d-flex"&gt;
                    &lt;img src="#" class="rounded-circle" alt="" /&gt;
                  &lt;/span&gt;
                  &lt;span class="media-body"&gt;
                    &lt;span class="heading-font-family media-heading"
                      &gt;Steve Smith&lt;/span
                    &gt;
                    &lt;span class="media-content"&gt;I slowly updated projects&lt;/span&gt;
                  &lt;/span&gt;
                &lt;/a&gt;
                &lt;a href="#" class="media"&gt;
                  &lt;span class="d-flex"&gt;
                    &lt;i class="ik ik-calendar"&gt;&lt;/i&gt;
                  &lt;/span&gt;
                  &lt;span class="media-body"&gt;
                    &lt;span class="heading-font-family media-heading"&gt;To Do&lt;/span&gt;
                    &lt;span class="media-content"
                      &gt;Meeting with Nathan on Friday 8 AM ...&lt;/span
                    &gt;
                  &lt;/span&gt;
                &lt;/a&gt;
              &lt;/div&gt;
              &lt;div class="footer"&gt;
                &lt;a href="javascript:void(0);"&gt;See all activity&lt;/a&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;button type="button" class="nav-link ml-10 right-sidebar-toggle"&gt;
            &lt;i class="ik ik-message-square"&gt;&lt;/i
            &gt;&lt;span class="badge bg-success"&gt;3&lt;/span&gt;
          &lt;/button&gt;
          &lt;div class="dropdown"&gt;
            &lt;a
              class="nav-link dropdown-toggle"
              href="#"
              id="menuDropdown"
              role="button"
              data-toggle="dropdown"
              aria-haspopup="true"
              aria-expanded="false"
              &gt;&lt;i class="ik ik-plus"&gt;&lt;/i
            &gt;&lt;/a&gt;
            &lt;div
              class="dropdown-menu dropdown-menu-right menu-grid"
              aria-labelledby="menuDropdown"
            &gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Dashboard"
                &gt;&lt;i class="ik ik-bar-chart-2"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Message"
                &gt;&lt;i class="ik ik-mail"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Accounts"
                &gt;&lt;i class="ik ik-users"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Sales"
                &gt;&lt;i class="ik ik-shopping-cart"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Purchase"
                &gt;&lt;i class="ik ik-briefcase"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Pages"
                &gt;&lt;i class="ik ik-clipboard"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Chats"
                &gt;&lt;i class="ik ik-message-square"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Contacts"
                &gt;&lt;i class="ik ik-map-pin"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Blocks"
                &gt;&lt;i class="ik ik-inbox"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Events"
                &gt;&lt;i class="ik ik-calendar"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="Notifications"
                &gt;&lt;i class="ik ik-bell"&gt;&lt;/i
              &gt;&lt;/a&gt;
              &lt;a
                class="dropdown-item"
                href="#"
                data-toggle="tooltip"
                data-placement="top"
                title="More"
                &gt;&lt;i class="ik ik-more-horizontal"&gt;&lt;/i
              &gt;&lt;/a&gt;
            &lt;/div&gt;
          &lt;/div&gt;
          &lt;button
            type="button"
            class="nav-link ml-10"
            id="apps_modal_btn"
            data-toggle="modal"
            data-target="#appsModal"
          &gt;
            &lt;i class="ik ik-grid"&gt;&lt;/i&gt;
          &lt;/button&gt;
          &lt;div class="dropdown"&gt;
            &lt;a
              class="dropdown-toggle"
              href="#"
              id="userDropdown"
              role="button"
              data-toggle="dropdown"
              aria-haspopup="true"
              aria-expanded="false"
              &gt;&lt;img class="avatar" src="img/user.jpg" alt=""
            /&gt;&lt;/a&gt;
            &lt;div
              class="dropdown-menu dropdown-menu-right"
              aria-labelledby="userDropdown"
            &gt;
              &lt;a class="dropdown-item" href="profile.html"
                &gt;&lt;i class="ik ik-user dropdown-icon"&gt;&lt;/i&gt; Profile&lt;/a
              &gt;
              &lt;a class="dropdown-item" href="#"
                &gt;&lt;i class="ik ik-settings dropdown-icon"&gt;&lt;/i&gt; Settings&lt;/a
              &gt;
              &lt;a class="dropdown-item" href="#"
                &gt;&lt;span class="float-right"
                  &gt;&lt;span class="badge badge-primary"&gt;6&lt;/span&gt;&lt;/span
                &gt;&lt;i class="ik ik-mail dropdown-icon"&gt;&lt;/i&gt; Inbox&lt;/a
              &gt;
              &lt;a class="dropdown-item" href="#"
                &gt;&lt;i class="ik ik-navigation dropdown-icon"&gt;&lt;/i&gt; Message&lt;/a
              &gt;
              &lt;a class="dropdown-item" href="#"
                &gt;&lt;i class="ik ik-power dropdown-icon"&gt;&lt;/i&gt; Logout&lt;/a
              &gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/header&gt;
  
  {% endblock %}
  
  </code></pre>
  
  <p>I have no idea why I get this error. I am trying to make a admin layout for my crm. I started with a base Contact model that I could work on and then tried to add a header and siderbar from a template I found on the web. But when I added the Header is gave me this... Please help. </p>
  
  <p>'Core' app url file</p>
  
  <pre><code>from django.urls import path, include
  from . import views
  
  urlpatterns = [
      path('', views.core, name='core'),
  ]
  
  </code></pre>
  
  <p>and 'Protocol' project url file </p>
  
  <pre><code>from django.contrib import admin
  from django.urls import path, include
  
  urlpatterns = [
      path('admin/', admin.site.urls),
      path('', include('core.urls')),
  ]
  
  
  </code></pre>
  
  <p>protocol is the name of the project and core the name of the app</p>