There are some old samples available online for doing this, but the 1.0 version of Django is not compatible with those. So I thought I’d share my solution for sending notification mails whenever there’s been posted a new comment on my Django site using Django signals.
The old way of connecting to a signal was:
dispatcher.connect(myFunction, signal=models.signals.post_save, [...]
The guys from Mercurytide released an updated version of their superhandy Django Cheat Sheet. Especially useful when you’re just starting with Django.
http://www.mercurytide.co.uk/whitepapers/django-cheat-sheet/
I was looking for something similar to print_r in PHP for Django. I haven’t really found something other than:
import pprint
pprint.pprint(dir(modelorobject))
and using:
{% debug %}
in your template, wich display all kinds of debug info.
If anyone has more info on debugging Django, or a print_r kind of way of outputting debug info, please use the comments.
In this context [...]
After upgrading to Django 1.0 I got the following error when using the new comment framework in one of my templates:
Caught an exception while rendering: Reverse for ” not found.
After some searching I read somewhere I had to delete the old .pyc files (from before the Django upgrade). After doing that, everything worked as [...]
I kept getting a validation error in the django admin pages while trying to upload an image. The validation error said:
Upload a valid image. The file you uploaded was either not an image or
a corrupted.
I really broke my brains on this one but finally got it to work! I knew for sure that [...]
A great beginners tutorial is the “Create a Wiki in 20 minutes” by Siddhi from Silver Stripe Software.
In the tutorial you’ll learn the basics of Django by walking you through the development of a simple wiki application. Other aspects in the tutorial are: URL design, database interaction, Django templates and editing pages using Markdown syntax.
The [...]
Go to c:/python2.4/lib/site-packages/django/core/validators.py
or
/usr/lib/python2.4/site-packages/django/core/validators.py , if you
are using Fedora
comment the following lines (the line numbers in my version is 186 and
187
trial_image = Image.open(StringIO(content))
trial_image.load()
could be related to http://code.djangoproject.com/ticket/7608
Ever wanted to use an old, existing, legacy database with a Django Project? That’s totally possible!
Django allows you to create a models.py file based on an existing database. To do this, you first have to make sure your database settings are properly specified in the settings.py file. Here’s an example of what the database settings [...]
The best tutorial to start with when beginning with Django is found on the Django Project website (www.djangoproject.com).
It assumes you already have Django installed, and takes you through the basics of the fabulous framework:
http://docs.djangoproject.com/en/dev/intro/tutorial01/