Hi Ben - I see you deleted your corresponding question on StackOverflow. Did you solve it?
Cheers,
- Matt
> On 22 Aug 2017, at 03:29, Ben Pateman <
bpat...@gmail.com> wrote:
>
> Still in development, I decided to switch over the body field for one of my wagtail.Page models from RichTextField to StreamField. In the wagtail admin interface I can create pages using this model without a problem, and StreamField seems to work fine. However, when viewing the resultant page I get the following error:
>
> Template error:
> In template D:\Documents\Dropbox\Work\TravelSite\travelnews\travelnews\templates\base.html, error at line 14
>
> expected
> string or bytes-like object 4 :
>
>
> 5 :
>
>
> 6 : <!DOCTYPE html>
>
>
> 7 : <!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7"> <![endif]-->
>
>
> 8 : <!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8"> <![endif]-->
>
>
> 9 : <!--[if IE 8]> <html class="no-js lt-ie9"> <![endif]-->
>
>
> 10 : <!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
>
>
> 11 : <head>
>
>
> 12 : <meta charset="utf-8" />
>
>
> 13 : <meta http-equiv="X-UA-Compatible" content="IE=edge" />
>
>
> 14 : <script src="https:/ /
ajax.googleapis.com/ajax/libs/jquery/2.2.4/jquery.min.js"></script>
>
>
> 15 : {% load bootstrap3 %}
>
>
> 16 : {% bootstrap_css %}
>
>
> 17 : {% bootstrap_javascript %}
>
>
> 18 : {% bootstrap_messages %}
>
>
> 19 :
>
>
> 20 : <title>
>
>
> 21 : {% block title %}
>
>
> 22 : {% if self.seo_title %}{{ self.seo_title }}{% else %}{{ self.title }}{% endif %}
>
>
> 23 : {% endblock %}
>
>
> 24 : {% block title_suffix %}
>
>
> Traceback:
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\exception.py" in
> inner
>
> 41. response = get_response(request)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in
> _get_response
>
> 217. response = self.process_exception_by_middleware(e, request)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\core\handlers\base.py" in
> _get_response
>
> 215. response = response.render()
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\response.py" in
> render
>
> 107. self.content = self.
> rendered_content
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\response.py" in
> rendered_content
>
> 84. content = template.render(context, self._request)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\backends\django.py" in
> render
>
> 66. return self.template.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render
>
> 207. return self._render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> _render
>
> 199. return self.nodelist.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render
>
> 990. bit = node.render_annotated(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render_annotated
>
> 957. return self.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\loader_tags.py" in
> render
>
> 177. return compiled_parent._render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> _render
>
> 199. return self.nodelist.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render
>
> 990. bit = node.render_annotated(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render_annotated
>
> 957. return self.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\loader_tags.py" in
> render
>
> 72. result = block.nodelist.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render
>
> 990. bit = node.render_annotated(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render_annotated
>
> 957. return self.render(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> render
>
> 1040. output = self.filter_expression.resolve(context)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django\template\base.py" in
> resolve
>
> 736. new_obj = func(obj, *arg_vals)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\wagtail\wagtailcore\templatetags\wagtailcore_tags.py" in
> richtext
>
> 73. html = expand_db_html(value)
>
>
>
> File "C:\Users\Ben\AppData\Local\Programs\Python\Python36-32\lib\site-packages\wagtail\wagtailcore\rich_text.py" in
> expand_db_html
>
> 180. html = FIND_A_TAG.sub(replace_a_tag, html)
>
>
>
> Exception Type: TypeError at /guide-paris/
> Exception Value: expected string or bytes-like object
> I initially thought it was a problem with database migrations, but have since dumped the whole test db and loaded up a fresh one, and the problem persists.
>
> This is the StreamField definition in my page model:
>
> body = StreamField([
>
>
> ('heading', blocks.CharBlock()),
>
>
> ('paragraph', blocks.RichTextBlock()),
>
>
> ('quote', blocks.BlockQuoteBlock()),
>
>
> ])
> Spent more time than I'd care to admit trying to get my head around why this is happening, so if anyone has any ideas on how to resolve this I'd be incredibly grateful!
>
>
> --
> You received this message because you are subscribed to the Google Groups "Wagtail support" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to
wagtail+u...@googlegroups.com.
> To post to this group, send email to
wag...@googlegroups.com.
> Visit this group at
https://groups.google.com/group/wagtail.
> To view this discussion on the web, visit
https://groups.google.com/d/msgid/wagtail/43f701ac-945d-45c3-a754-492d689f21cc%40googlegroups.com.
> For more options, visit
https://groups.google.com/d/optout.