Django Revisions
Custom Actions In Django Admin Object Editor
Tuesday, October 7th, 2008I’ve seen many posts asking for the simplest feature in Django admin… the ability to add custom actions next to History and View On Site in the Django admin form. The page where the actual object is edited, not the list pages. Imagine adding actions like:
Edit Next Item
Edit Previous Item
Send Thank You Email
Export [...]
OneToOne Fields And The Primary Key Issue
Monday, June 23rd, 2008Django provides one-many ForeignKey, many-many ManyToManyField, and one-one OneToOneField options for defining table relationships. The OneToOneField specifically has recently been the topic of heated debates and ideas. Unlike the other options this field is by always constrained to be a “Primary Key”. The restriction implies that each table may ONLY have one [...]
Authenticating Using Email vs Username
Sunday, May 18th, 2008A few weeks back I posted the full source for user logins and password recovery under Everything A Django Developer Needs To Create Logins. There was a little bit of flack from some very passionate and smart individuals (James Bennet) insisting that this middle ware already exists in "contrib.auth;". On the other hand [...]
Django Deserializer Bug On Foreign Key When None
Monday, February 18th, 2008THis is more for myself than anyone else but remind me to submit this to the bug list. Or at least check if it exists already. When deserializing a model with a foreign key whose value is set to None I get the following exeption:
The Bug
File “/home2/pkenjora/lib/python2.4/django/core/serializers/python.py”, line 82, in Deserializer
[...]
Adding Custom Actions To Django Admin Change Forms
Wednesday, November 7th, 2007I recently had a problem where I needed to add a custom action next to "History" and "View on site" in the Django admin change form for a specific model. Normally I would overload the admin template. Problem is I wanted to retain "History" and "View". The approach I took was to [...]
Connecting To Oracle Directly (Without settings.py)
Tuesday, October 23rd, 2007I recently ran into an situation where I needed to connect to both an Oracle DB and my local DB simultaneously in Django. I was porting data between the two. After spending an hour online hunting around for how to use cx_Oracle I finally found a working example. I first got things [...]
Modify Django To Support Group By Query Function
Sunday, September 9th, 2007Group by is used extensively in many day to day SQL queries. Although most often it is used for counting sometimes group by comes in handy for creating an artificial unique constraint. For example say you have a list of URLS that are described by a checksum and you wish to query a [...]
Modify Django To Support Binary Order By
Monday, August 20th, 2007Binary order by is different from simple order by in that it is case sensitive. Python’s string comparison operators are also case sensitive. So for any order_by query on a string column in MySQL the results are not in the order Python expects. This leads to serious problems when you try to [...]