Could not parse the remainder template inheritance

185 views
Skip to first unread message

Matthew

unread,
Jan 1, 2016, 11:08:57 PM1/1/16
to Django users
Hi all,

I'm working through the masteringdjango book, and am struggling in the Templates area.

I created a base.html base template, and am attempting to include a child template.

This is the child template:

{% extends “base.html” %}

{% block title %}The current time{% endblock %}

{% block content %}
<p>It is now {{ current_date }}.</p>
{% endblock %}

When I run the site, I get the following error message: 

Could not parse the remainder: '“base.html”' from '“base.html”'


And it points to the first line of the child template.

I don't understand what I am doing wrong, please help.

James Schneider

unread,
Jan 2, 2016, 12:44:22 AM1/2/16
to django...@googlegroups.com

Was this template code primarily copied/pasted from an example?

Can you try deleting and manually typing new quotes around the base.html reference in your {% extends %} tag?

Not sure if it's my email client or not, but those appear to be "smart quotes", which lean left/right, usually automatically inserted by editor applications like MS Word or possible from a translation from text to PDF to make things "pretty".

To a computer parser like the Django template system, those are interpreted differently as regular characters rather than quotes, which would explain the parser error you are receiving. Hard to spot, but I've been bit by that type of subtle bug before.

-James

Matthew

unread,
Jan 2, 2016, 10:52:22 AM1/2/16
to Django users
Hi James,

I turned smart quotes off and am still having the error.  I wasn't aware that could cause future errors though, so thanks for the heads up!

Matthew

unread,
Jan 2, 2016, 11:11:17 AM1/2/16
to Django users
Actually it turned out this works!! My TextEdit app was being finnicky and made me re-write the entire code instead of just the quotation marks. Thanks for the help!

Lee Hinde

unread,
Jan 2, 2016, 11:13:59 AM1/2/16
to django...@googlegroups.com
If you’re just getting your feet wet and don’t want to invest in an editor/IDE just yet, try TextWrangler: http://www.barebones.com/products/textwrangler/  It’s free and won’t get in your way.

François Schiettecatte

unread,
Jan 2, 2016, 11:18:19 AM1/2/16
to django...@googlegroups.com
And if you like it you should just buy BBEdit from BareBones, been using it for years, it’s great.

François
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
> To post to this group, send email to django...@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-users.
> To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CE45DD84-98D8-406D-A829-CF0C2B7AB86D%40gmail.com.
> For more options, visit https://groups.google.com/d/optout.

James Schneider

unread,
Jan 2, 2016, 6:36:03 PM1/2/16
to django...@googlegroups.com


On Jan 2, 2016 8:11 AM, "Matthew" <mbd...@gmail.com> wrote:
>
> Actually it turned out this works!! My TextEdit app was being finnicky and made me re-write the entire code instead of just the quotation marks. Thanks for the help!
>

That seems a bit odd. I can see why just turning off the smart quotes wouldn't help. It probably didn't replace any already existing quotes in your code when you did that. If you have the option, also make sure that all of your files are using UTF-8 encoding by default, which should cut down on some of that noise.

I always recommend going with a full IDE if you want a good experience. I highly recommend PyCharm. The community edition works well with Django and Python in general. The professional edition includes some bells and whistles for setting up new projects and advanced debugging, but isn't necessary for personal/casual use. Having the extra help with automatic variable and method reference lookups is pretty invaluable. I always end up accidentally discovering functionality this way.

Glad you got it sorted though.

-James

Reply all
Reply to author
Forward
0 new messages