When you are using phpMyadmin on MAMP or MAMP Pro out of the box, you might run into trouble trying to import large databases due to PHP’s default upload and timeout settings. This post explains the quick-fix needed to get it working.
This post outlines a simple Django app that allows the user to upload an image via an URL while making sure the image file is valid.
One of my most popular Stackoverflow answers is to a question regarding the confusion between static and media files in Django. This post elaborates on that theme.
In a previous post I outlined a sane folder structure for a new Django project. Since then Django 1.5 (and 1.6) has been released along with an updated default folder structure. This post goes through some further tips on keeping your django project layout sensible.
Sorl-thumbnail has a sensible crop function in the default engine, but sometimes you need a little more control over the results. This post provides a custom cropping PIL engine that can be used to return specific, i.e. from (x1, y1) to (x2, y2), cropped thumbnails
It’s very easy to generate URLs to your django models using
get_absolute_url(), but you can also use this pattern to just as easily create URLs to the admin page for your django models too. This post shows you how to make a
get_admin_url() model method that generates links to give you quick access to your admin.
GenericRelations with Django to create unique generic foreign keys between objects, it can become tiresome having to navigate the
RelatedManager every time you need to retrieve the single instance of the one-to-one relationship. This post shows how creating a quick
Mixin can help overcome this inconvenience.
Django’s annotate method can be useful for counting particular attributes on every member of a queryset (i.e. count the number of books an author has). Unfortunately you can’t use the ORM to do any filtering on those attribute. This would be useful for only considering an attribute if it were above a certain value, or belonged to a certain object (i.e. count the number of books with the tag ‘Horror’). This post shows how to make use of the
extra method Django provides to create filtered annotations