Archive for June, 2009

Problem with Django ‘Log out’ link in Admin

Thursday, June 25th, 2009

I got errors like the following while trying to logout of Django Admin:

ValueError at /admin/mymodels/mymodel/12/admin/logout/

invalid literal for int() with base 10: ‘12/admin/logout’

Request Method: GET
Request URL: http://127.0.0.1/admin/mymodels/mymodel/12/admin/logout/
Exception Type: ValueError
Exception Value:

invalid literal for int() with base 10: ‘12/admin/logout’

Turns out it’s bug listed here: http://code.djangoproject.com/ticket/10061

A temporary suggestion that works was made by carljm

In case it’s helpful to others: the simplest and least invasive temporary workaround is to just add this line in your urls.py:

admin.site.root_path = ‘/admin/’

If you run the admin at an alternate URL, just use the correct one here; if you run multiple admin instances, you can set the root_path for each one in the same way.

Kernel upgrade on Ubuntu 9.04 running in VMware Fusion

Wednesday, June 24th, 2009

If you’re running Ubuntu 9.04 in VMware Fusion (2.04) you’ve probably come across the following post from VMware:

Ubuntu 9.04 “Jaunty Jackalope” on VMware Fusion 2

If you upgrade the kernel you’ll have to follow the instructions again making sure to do the following as mentioned in one of the comments:

What did work for me was to:

sudo apt-get remove xserver-xorg-input-vmmouse

and then

sudo apt-get install xserver-xorg-input-vmmouse

I then logged out, restarted the Xserver..

django save() error

Tuesday, June 23rd, 2009

I got this got this error recently when trying to add the first entry of a model in the Admin section:


Request Method: GET
Request URL: http://mydomain/admin/escorts/escort/None/
Exception Type: ValueError
Exception Value: invalid literal for int() with base 10: 'None'

Exception Location: /lib/python2.6/site-packages/django/db/models/fields/__init__.py in get_db_prep_value, line 361
Python Executable: /usr/bin/python

Turns out I had overridden the save() function and it had worked fine. However the models.py file got corrupted and I lost the last few lines of the file including a line from my overridden save() function:

super(myModel, self).save(force_insert=True)

Install git on Ubuntu 9.04 (Jaunty)

Monday, June 22nd, 2009

Installing git using

sudo apt-get install git

I noticed that it was only version 1.6.04.

So thanks to Peter Vandenabeele for posting how he installed git – I had to make a few adjustments:

$ sudo apt-get build-dep git-core git-doc libssl-dev
$ wget http://kernel.org/pub/software/scm/git/git-1.6.3.3.tar.gz
$ tar -xvzf git-1.6.3.3.tar.gz
$ cd git-1.6.3.3/
$ make prefix=/usr all doc
$ sudo make prefix=/usr install install-doc
$ git --version
git version 1.6.3.3

I used "prefix=/usr" because version 1.6.0.4 wasn't removed after I did a "sudo apt-get remove git".