Django: TemplateSyntaxError: Could not parse the remainder

前端 未结 6 1380
深忆病人
深忆病人 2020-12-15 02:22

I am getting this issue when I type localhost:8000/admin/.

`TemplateSyntaxError: Could not parse the remainder: \':password_change\' from

相关标签:
6条回答
  • 2020-12-15 03:01

    In templates/admin/includes_grappelli/header.html, line 12, you forgot to put admin:password_change between '.

    The url Django tag syntax should always be like:

    {% url 'your_url_name'%}
    
    0 讨论(0)
  • 2020-12-15 03:03

    There should not be a space after name.

    Incorrect:

    {% url 'author' name = p.article_author.name.username %}
    

    Correct:

    {% url 'author' name=p.article_author.name.username %}
    
    0 讨论(0)
  • 2020-12-15 03:05

    You have indented part of your code in settings.py:

    # Uncomment the next line to enable the admin:
         'django.contrib.admin',
        # Uncomment the next line to enable admin documentation:
        #'django.contrib.admindocs',
         'tinymce',
         'sorl.thumbnail',
         'south',
         'django_facebook',
         'djcelery',
         'devserver',
         'main',
    

    Therefore, it is giving you an error.

    0 讨论(0)
  • 2020-12-15 03:12

    also happens when you use jinja templates (which have different syntax for calling object methods) and you forget to set it in settings.py

    0 讨论(0)
  • 2020-12-15 03:19

    This error usually means you've forgotten a closing quote somewhere in the template you're trying to render. For example: {% url 'my_view %} (wrong) instead of {% url 'my_view' %} (correct). In this case it's the colon that's causing the problem. Normally you'd edit the template to use the correct {% url %} syntax.

    But there's no reason why the django admin site would throw this, since it would know it's own syntax. My best guess is therefore that grapelli is causing your problem since it changes the admin templates. Does removing grappelli from installed apps help?

    0 讨论(0)
  • 2020-12-15 03:23

    Template Syntax Error: is due to many reasons one of them is {{ post.date_posted|date: "F d, Y" }} is the space between colon(:) and quote (") if u remove the space then it work like this ..... {{ post.date_posted|date:"F d, Y" }}

    0 讨论(0)
提交回复
热议问题