﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
15082	delete() does not function consistently with CharField PKs	w004dal	nobody	"I'm working with MyISAM tables with MySQL and have the following behavior with delete() on Django 1.2.3-1 on Fedora Core 12.
{{{
class DoesWork(models.Model):
    mac_id = models.CharField(max_length=17)
    ip = models.CharField('Host/IP Address', max_length=255)

class DoesNotWork(models.Model):
    mac_id = models.CharField(max_length=17, primary_key=True)
    ip = models.CharField('Host/IP Address', max_length=255)
}}}
The following works as expected, creating, deleting, and putting the item back:
{{{
zz = DoesWork.objects.create(mac_id='99:99:99:99:99:99', ip='127.0.0.1')
zz.delete() # remove from DB
zz.save() # it's back in the DB
}}}
However, if I use the DoesNotWork model, whose only difference is having a CharField as a primary key:
{{{
zz = DoesNotWork.objects.create(mac_id='99:99:99:99:99:99', ip='127.0.0.1')
zz.delete() # remove from DB
zz.save() # EXCEPTION THROWN:

IntegrityError: (1048, ""Column 'mac_id' cannot be null"")
}}}
I checked by printing out zz.!__dict!__, and the mac_id was 'None' with the DoesNotWork object, but was untouched with the DoesWork object."		closed	Core (Other)	1.2		invalid	model, db	w004dal@…	Unreviewed	0	1	0	0	0	0
