Login

Tag "documentation"

Snippet List

Help text hyperlinks

Sometimes a plain-text help-text isn't sufficient, and it's handy to be able to add links to pages, documentation or external websites. This javascript snippet can be added to your page, in combination with adding a class to your help text in your template. This assumes you're using jQuery on your website. Field template snippet: ``` {% if field.help_text %}<p class="help-text">{{ field.help_text }}</p>{% endif %} ``` On document ready, this will convert the markdown-style links into anchor tags, allowing you to have richer help text for your users

  • help
  • link
  • documentation
  • docs
  • href
  • help_text
Read More

Auto-documenting Django Models with Sphinx

In my sphinx documentation I really wanted a nice clean list of the fields on my Django models. The most obvious way of doing this is to add ":param blah:" tags to the docstring, but this takes a long time to implement and violates DRY principles when you already have lots of nice help text in the model definition. Another way is to use "#:" comments on attributes, but this approach suffers from the same issues as the previous method with the additional problem of Sphinx crapping out on file and custom fields. So anyway, this is my solution. It uses the Sphinx docstring processing callback to intercept any objects that inherit from django.models.Model and creates a nice param list of all the fields on that model. Param descriptions come from the field's help text or verbose name if no help text is defined. To use this, just add it to the end of your source/conf.py, filling out the project path as appropriate. You may be able to skip the Django environment setup lines if you're adding this to a Sphinx doc that already has Django models set up.

  • sphinx
  • introspection
  • documentation
  • docs
  • autodoc
Read More

Debug view: show available named URL patterns

Hook the show_url_patterns view function in to your URLconf to get a page which simply lists all of the named URL patterns in your system - useful for if your template developers need a quick reference as to what patterns they can use in the {% url %} tag.

  • urlconf
  • debug
  • debugging
  • urlpatterns
  • documentation
  • docs
Read More

Search Docs with Shortwave

. . For use with [Shortwave](http://shortwaveapp.com/). Add this to your hosted `wave.txt` for a search of the current Django docs.

  • search
  • documentation
  • shortwave
Read More

Create nice looking PDFs from developer documentation

You need htmldoc, rst2html, the Python Imaging Libraray, BeautfiulSoup and spoon. The Debian/Ubuntu-packages are called htmldoc, python-docutils, python-imaging and python-beautifulsoup You can get spoon.py http://beautifulspoon.googlecode.com/svn/trunk/spoon.py To create the pdf files you have to call the script from django_src/docs Here is an example output: http://henning.cco-ev.de/django/essential.pdf

  • pdf
  • documentation
  • docs
Read More

5 snippets posted so far.