Note that there are some explanatory texts on larger screens.

plurals
  1. PODjango unable to load Bootstrap Modal: UnicodeDecodeError
    primarykey
    data
    text
    <p>Lets say I have a simple Django View and Template (nothing complex). Just renders some data from database onto template (I am using bootstrap project)</p> <p>Now, I am looking to put a Form (say a contact-form) on the page. I thought to use <a href="http://twitter.github.com/bootstrap/javascript.html#modals" rel="nofollow">Bootstrap Modal</a> feature, where on clicking a Button, the modal will toggle onto the page (here a contact-form).</p> <p>For initial testing, I just copied the example code:</p> <pre><code>&lt;!-- Button to trigger modal --&gt; &lt;a href="#myModal" role="button" class="btn" data-toggle="modal"&gt;Launch demo modal&lt;/a&gt; &lt;!-- Modal --&gt; &lt;div id="myModal" class="modal hide fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true"&gt; &lt;div class="modal-header"&gt; &lt;button type="button" class="close" data-dismiss="modal" aria-hidden="true"&gt;×&lt;/button&gt; &lt;h3 id="myModalLabel"&gt;Modal header&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;p&gt;One fine body…&lt;/p&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;button class="btn" data-dismiss="modal" aria-hidden="true"&gt;Close&lt;/button&gt; &lt;button class="btn btn-primary"&gt;Save changes&lt;/button&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>However, what I found is:</p> <p>When I simply remove the HTML needed to present inside modal, its working.</p> <p>something like.</p> <p> </p> <pre><code> &lt;h3 id="myModalLabel"&gt;Modal header&lt;/h3&gt; &lt;/div&gt; &lt;div class="modal-body"&gt; &lt;/div&gt; &lt;div class="modal-footer"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>As its just template editing, I refreshed page and found an <strong>UnicodeDecodeError</strong>:</p> <pre><code>Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) File "D:\Code\Projects-Dev\cloudnote\note\views.py" in home 21. return render_to_response('home.html', context) File "C:\Python27\lib\site-packages\django\shortcuts\__init__.py" in render_to_response 20. return HttpResponse(loader.render_to_string(*args, **kwargs), **httpresponse_kwargs) File "C:\Python27\lib\site-packages\django\template\loader.py" in render_to_string 169. t = get_template(template_name) File "C:\Python27\lib\site-packages\django\template\loader.py" in get_template 145. template, origin = find_template(template_name) File "C:\Python27\lib\site-packages\django\template\loader.py" in find_template 134. source, display_name = loader(name, dirs) File "C:\Python27\lib\site-packages\django\template\loader.py" in __call__ 42. return self.load_template(template_name, template_dirs) File "C:\Python27\lib\site-packages\django\template\loader.py" in load_template 45. source, display_name = self.load_template_source(template_name, template_dirs) File "C:\Python27\lib\site-packages\django\template\loaders\app_directories.py" in load_template_source 57. return (file.read().decode(settings.FILE_CHARSET), filepath) File "C:\Python27\lib\encodings\utf_8.py" in decode 16. return codecs.utf_8_decode(input, errors, True) Exception Type: UnicodeDecodeError at /app/home/ Exception Value: 'utf8' codec can't decode byte 0xd7 in position 6904: invalid continuation byte </code></pre> <p>Where the code is going wrong and how to fix it?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload