Simple answer: If you're already running Wagtail or planning to run it on your site, you'll probably benefit from an integrated blog like wagtail_blog. It may not be full of features in itself, but since Wagtail is, you can easily go where you want. I'm adding support ...Read the rest of this entry »
So, you need to limit choices, because the list of related choices is too long? Then do NOT use
limit_choices_to parameter on the ForeignKey! Why? Because you risk having options missing in your forms, deleting relations unknowingly.
For instance, consider that you have the following case, expressed in pseudo code ...Read the rest of this entry »
Warnings are often suppressed through many layers of control mechanisms in Python and Django. However, you should really be aware of these and clean them up once in a while!
In other cases, the Warnings reflect an inconsistent state, such as if you are mixing naive and timezone-aware variables. It ...Read the rest of this entry »
Here is a very simple mechanism for wrapping a decorator around your views to protect them against brute force attempts. For instance, if you have a secret file download available only with the right secret (/view/id/secret-hash/), you expose your view to simple brute force attempts.
Simply put, this ...Read the rest of this entry »
Here's an example for a custom change_form.html located in app/templates/admin/appname/modelname/change_form.html - and the cool thing is that it accesses the actual instance of the object, which I found to be very convenient and undocumented. If you want it to be more explicit than ...Read the rest of this entry »
If you are running an old version of django-cms, you can still upgrade Django. I would strongly suggest doing this since it's very uncomplicated. However, if you are running django-cms 2.0, you should first upgrade to 2.0.2 and run the South migrations, which is also totally ...Read the rest of this entry »
In case you need a quick way of getting rid of spammers on your apache server, use this method as a temporary solution until you find a better one.
Please take not that it will evaluate EVERY SINGLE REQUEST through a Deny policy in Apache's mod_access - it does not ...Read the rest of this entry »
Often the Django Admin should look a little different for the sake of your users or for the sake of yourself (running multiple django sites with identical looks and titles can be such a pain). Often users don't know what Django is, and it takes ages to explain, and ...Read the rest of this entry »
In the Django documentation we see the following:
When you're manually logging a user in, you must call authenticate() before you call login().
That's all really nice, because it makes sure that all your authentication backends are tried out; but if you want a really quick remedy for ...Read the rest of this entry »
UPDATE! This is going to be redundant in Django 1.2, in which you can add DATE_FORMAT to your django.po files.
I've often been frustrated that using settings.DATE_FORMAT does not give a localized date. Granted that the name of a month may be localized, but the format ...Read the rest of this entry »
It was bothering me that all the wikis I tried, all had either errors, feature lacks, too many dependencies or were simply unmaintained. So I decided to create yet another one. Curiously, the third hit when googling 'django wiki' is Create a wiki in 20 minutes. Luckily that's not ...Read the rest of this entry »
This post is for everyone who's realized that Django power does not come from the ability to easily write all the logic yourself -- rather it's the ability to integrate apps with each other, yet only messing about with your own source tree, and not the apps you've ...Read the rest of this entry »
This MUST be a common issue for international developers: We use some geeky English name for our application and afterwards find that the translated admin index looks a little silly in the eyes of our native speaking users. Apparently a patch has been accepted in the Django dev version, but ...Read the rest of this entry »
What's really nice in Django is the gettext implementation and the _ convention. But when running django-admin.py makemessages we're not generating any translations for dynamic values such as field values. So let's say that we have a model and we'd like what's in it ...Read the rest of this entry »
I did a Google search and since nothing came up, I'm writing this little tip on creating your own CMS by extending Django's flatpages. What's good about flatpages is that they're included in Django and has some basic code to get you started. But clearly they ...Read the rest of this entry »