Login

Tag "pretty-print"

Snippet List

Do Not Escape Characters When Using dumpdata Command (Tested in Django 1.11)

Adds `--pretty` option to django `./manage.py dumpdata` command, which produces pretty utf-8 strings instead of ugly unicode-escaped s**t: > $ ./manage.py dumpdata app.pricingplan --indent=1 <pre> <code>[ { "pk": 1, "model": "app.pricingplan", "fields": { "name": "\u0411\u0430\u0437\u043e\u0432\u044b\u0439", } }, { "pk": 2, "model": "app.pricingplan", "fields": { "name": "\u0425\u0443\u044f\u0437\u043e\u0432\u044b\u0439", } } ] </code> </pre> > ./manage.py dumpdata app.pricingplan --indent=1 --pretty <pre> <code>[ { "pk": 1, "model": "app.pricingplan", "fields": { "name": "Базовый", } }, { "pk": 2, "model": "app.pricingplan", "fields": { "name": "Хуязовый", } } ] </code> </pre> Forked from an [old versions snippet](https://djangosnippets.org/snippets/2258/)

  • pretty
  • dumpdata
  • pretty-print
Read More

Pretty Print Template Tag

This defines a new template tag that lets you print your rendered templates (or partial templates) in html that has been prettified by beautiful soup. It is dependent on the beautiful soup library (bs4). Not recommended for production but it is helpful for development and serving readable html. {% load whatever_template_file %}' <body> {% pretty %} <h1>Hello, world.</h1> {% endpretty %} </body>

  • beautiful-soup
  • template-tag
  • pretty-print
Read More

2 snippets posted so far.