Category archives: Snaking
Discussions of programming, particularly of programming Python
Run coverage of your Django test suite...
Written by
on
in
Snaking.
Since there is a 4-year old still-open ticket on this, thought I'd provide a simple recipe for getting a coverage report on your Django project:
pip install coverage
coverage run path/to/django-admin.py test myapp
coverage report -m --include="*myapp*"
coverage erase # clean up afterward/between runs
Sure, it's not --with-coverage, but it does seem to work.
Choices for Foo?
Written by
on
in
Snaking.
The choices_for_FOO hook would allow a model to restrict the choices for a given field based on e.g. another field (common requirement where you have row-level authorization and need to restrict choices to the set of records accessible by the auth-row attached to this object). It's currently a patch attached to a 5 year old ...
FakeLion rides the PyPI
Written by
on
in
Snaking.
Put a bit more work into FakeLion (L10N, get it) this afternoon to see how a particular project is doing on getting i18n coverage. I added some quick flags so you can suppress HTML-code escaping, suppress Python string-subs escaping, disable the reversing of strings, and use full-width-latin substitution characters (which does a pretty good job ...
Quick Hack to do Psuedo-Localization (l10n)
Written by
on
in
Snaking.
Pseudo-localization lets you easily see which strings in your site are not yet marked for translation. That's pretty useful if you don't yet have a real translation, but want to check whether someone could do a translation if you paid them to do so. Didn't find a good package freely available (though I imagine there ...
Django + JQuery Mobile Quick Start Tutorial
Written by
on
in
Snaking.
I've uploaded a tutorial and a very minimal library for creating JQuery Mobile sites with Django. It's actually the first time I've used PyPI's documentation hosting system, mostly because Launchpad doesn't have a web-page hosting mechanism. The library (django-jqm) is not intended to be a platform for creating "real" sites, it's just a bunch of ...
JQuery Mobile Django Baseline
Written by
on
in
Snaking.
Playing with a JQuery Mobile baseline template for Django this afternoon. Just a set of templates, urls, static files, etceteras which give a "mobile app-like" base from which to begin development in a new project. I'm not particularly satisfied with it yet; I coded it directly into a "regular" app, and it really should have ...
Dumb PyDoc Replacement for PyOpenGL
Written by
on
in
Snaking.
I have been using "standard" Pydoc (actually slightly hacked) to document PyOpenGL outside the man pages, but PyOpenGL is almost entirely composed of things that don't work well with the standard tools; functions are actually class instances that check for availability before attempting to call, "functions" are defined in "raw" modules then imported into their ...
Miscellaneous jQuery Mobile + Django tips
Written by
on
in
Snaking.
Some little tips on how to make your "normal" Django site work properly under jQuery mobile:
- as mentioned before, put your JQM setup code into a base template that all of your mobile pages extend, this means that users can go to any "normal" url and still get the jQuery effects loaded
- create a "content" ...
OpenGL 3.x and 4.x man pages integrated
Written by
on
in
Snaking.
The OpenGL 3.x and 4.x man-pages are now integrated into the PyOpenGL documentation. Let me know if you find any bugs in the conversions.
jQuery Mobile + Django gets Pleasantly Out of the Way
Written by
on
in
Snaking.
Have been doing quite a bit of work combining jQuery Mobile with Django for certain (internal) projects. You can set up the JQM stuff with a few lines in your template, then mostly "forget" about it while developing a regular Django form-based site (though you'll want to use HTML5 widget types). The only major things ...