Category: Django
Keeping things in sync: derive vs test
There are times when we need to stop trying to make everything sync automatically, and just test that it is synced. Tips for Python and web dev.
pyastgrep and custom linting
Methodology and sample code for using pyastgrep to do custom linting tasks on Python source code.
Enforcing conventions in Django projects with introspection
Some code and tips to combine Python and Django introspection APIs to enforce naming conventions in your Django models.
Re-using CSS for the wrong HTML with Sass
A trick I learned for using someone else’s CSS without changing your HTML, or their CSS
Django and Sass/SCSS without Node.js or a build step
How to use Sass/SCSS in a Django project, without needing Node.js/npm or running a build process
Python’s “Disappointing” Superpowers
A response to Hillel Wayne’s “I am disappointed by dynamic typing”
Raising exceptions or returning error objects in Python
How returning error objects can provide some advantages over raising exceptions in Python, such as for static type checking tools.
REPL Python programming and debugging with IPython
The flows I use for exploratory programming using a REPL and their advantages.
A Django PAGNI: efficient bulk properties
When using Django database models and adding a calculated property of some kind, you should probably ensure it will be efficient in bulk even if that isn’t needed yet.
Evolution of a Django Repository pattern
Test smarter, not harder
Tips for winning the automated testing battle.
Announcement: Django Views - The Right Way
Announcement of my guide to writing Django Views.
Double-checked locking with Django ORM
How to implement the classic double-checked locking pattern with Django ORM/PostgreSQL.
6 digit OTP for Two Factor Auth (2FA) is brute-forceable in 3 days
OTP/TOTP for two factor auth (2FA/MFA) is very easy to misunderstand and implement insecurely
WordPress 4.7.2 post mortem
Some lessons from the recent WordPress vulnerability
Django admin tips Twitter account
Follow @djangoadmintips for curated tips about the Django admin
Avoid Django's GenericForeignKey
Why Django's GenericForeignKey is (usually) a bad idea
Dynamically generated Django admin actions
How to use ModelAdmin.get_actions with dynamically generated list of actions
A simple password-less, email-only login system
A simple password-less login system to consider for some use cases, with Django code.
We need less powerful languages
We need languages and systems that are less powerful, not more powerful, and easy ways to create and use such languages.
My approach to Class Based Views
A way to use Class Based Views and avoid some of the problems with Django's versions.
Handling Django's get_query_set rename is hard
Trickiness surrounding subclassing
How to learn Django without installing anything
Pretty much what it says in the title...
Approval and acceptance in the tech community
My reasons why I disapprove of gay marriage, but will treat those who disagree with me with all the respect and kindness I can.
Wedding hacks - seating planner using simulated annealing
Some attempts to solve the seating headache with software.
Wedding hacks - John Lewis gift list hyperlink
Using my programming skills for higher purposes, part 1
MVC is not a helpful analogy for Django
We should just introduce people to MVT
Bundling dependencies
Some answers and questions on the subject of bundling copies of dependencies in a project
Best practices with Django on WebFaction
WebFaction should encourage a much better deployment process
Now it's your turn
Porting a Django app to Python 3
Translating sentences with substitutions
Some ideas about solving translation problems with computer generated text.
Full screen WebView Android app
A complete WebView Android app, full screen, with a progress bar and back button that works as normal
Why escape-on-input is a bad idea
With examples from the web development world especially PHP, and lessons for Pythonistas
PHP, Python and Persuasion
Notes to self on how (not) to convince people.
Never fix a bug twice
A response to "Things you should test" by Noah Sussman.
Django's CBVs were a mistake
Django's CBVs are complex, unpythonic solutions to simple problems, (IMHO :-), here's why.
Reasons to love Django, part x of y
I've probably written lots of blog posts on this, so I can't claim 'x' = 1, and I've no idea what 'y' is...
LearnScripture.net launched
I launched my new Django Bible memorization site, LearnScripture.net
Async Raven/Sentry client with Django/Python
How to do logging calls to Sentry asynchronously (until Sentry gets UDP support).
Some quick Django optimisation lessons
Some tips for keeping your Django apps lean and mean from the beginning, using lessons from django-fiber,
Starter fabfile and scripts for a Django project on Webfaction
A quickstart for deploying a Django project to a shared hosting system like WebFaction.
A prayer to the programming gods
O gods of software development and operations, I have sinned. Your anger falls on me, and I feel your wrath...
Announcing django-easyfilters (with some heresy on the side)
Announcing django-easyfilters, a new library for Django, and a bit of heretical editorial about Django's ORM.
Docs or it doesn't exist
Writing good quality documentation for the software libraries you publish always matters. Otherwise, you are doing the world a disservice by publishing.
django-anonymizer released
An app to help protect your customers' data when in development.
django-output-validator released
finally got round to cleaning up my Django validator app...
Fuzzy testing with assertNumQueries
When assertNumQueries is overkill...
Class Based Views and Dry Ravioli
Class based views are very cool. I am starting to clean up an existing project using them, and lots of existing views are turning into declarative code. But it makes me worried about the ravioli effect.
Use JSON instead of YAML for Django test fixtures
Today I learned that JSON is much faster than YAML for use in Django fixtures...
The kind of comments that will get ignored on Django's Trac
Participating in any Open Source project can be frustrating if things do not move along as quickly as you would like. Django is a fairly popular project, whose developers are volunteers with limited resources, and with a pretty big commitment to stability and backwards compatibility, so there will always be people who get frustrated. This blog post is intended to help people in that situation be helpful, and to not actually make things worse.
Eclipse, PyDev, Django and virtualenv
How I set up Eclipse to work with an existing project using virtualenv
Is static type checking a redundant testing mechanism?
Based on my recent Haskell experience, I highlight some cases where I think static type checks provide a better testing mechanism than unit tests or other automated tests.
Review: Django 1.0 Template Development
A review of "Django 1.0 Template Development" by Scott Newman, from Packt Publishing.
Multiple output formats in Django
An article from Django 1.0 Template Development by Scott Newman, about how to output a document in multiple formats/styles using Django templates.
Ella
Beginnings of a Django-inspired Haskell web framework, Ella.
Managing Django patches using Mercurial
A simple way to use Mercurial Queues in a Subversion working directory to manage patches before committing to Subversion.
Django, Python 2.5 and memory usage
After reading that in Python 2.5 some big memory leaks are fixed, I just switched a Django site from Python 2.4 to Python 2.5. I wasn't disappointed -- the combined memory usage of my Apache processes (which are using mod_python) went from 100Mb to 60Mb. So, for anyone else wanted to conserve memory, this is the first thing I'd suggest!
Django newforms-admin upgrade
Django newforms fixes lots of things...
Bible memorisation web app
I created a system and web app to help me organise my Bible memorisation. And I rant a bit Django and web.py.
Django and Twill
How to use Twill within Django unit tests
AJAX validation with Django, newforms and MochiKit
I present below some example code for using Django, newforms and MochiKit to do AJAX validation, in case anyone else is doing the same, complete with a live demo...
Django Validator 1.3
I've updated my validator app to work with 'unicodised' Django...
Django validator updated
I've updated my `validator app `_ to latest Django trunk and finally done a release.
A Django website that took (a lot) more than 20 minutes.
An attempt to debunk some of the '20 minute web app' hype that is so prevalent at the moment, and present a more realistic and balanced account of the Django site I have just finished.
Django-updates gem
Saw this gem by 'anonymous' on django-updates...
Empty files and templates
I've noticed in Python and in Django I almost always create a module or a template by starting with a completely empty file, and typing...
pychecker vs pylint vs Django
Using pychecker and pylint on Django – and each other...
Django Admin Hack - Fields varying with user permissions
Here is a not-too-awful hack to make the admin give different 'add/change' forms depending on who is using it.
Clipboard diff
Ever been refactoring code or HTML templates and wanted to compare two chunks of text? This is what you need if you use KDE...
Updated validator and CsrfMiddleware
I've released some small updates to my 'Django validator app' and 'CsrfMiddleware'...
Django dreaming
Remembering the "Don't Repeat Yourself" mantra, the following apps would be awesome...
Django validator app. And fuse/webdav/bazaar
I wrote a quick Django application to help me develop compliant web sites, and put it together so it's easy to distribute...
Cross Site Request Forgeries
I've implemented a module that provides protection against Cross Site Request Forgeries for Django - and as always with both Python and Django, I've got that "surely it can't be that easy" feeling...
Django
Just discovered the Django web development framework, and I think I'm in love...