I prepared following repro case, just paste to models.py to an empty
project:

-----------------------------------------------------------
from MySQLdb import Warning as Warning
from django.db import models
import unittest

class TestModel(models.Model):
    char_field = models.CharField(max_length=5)

class Case1(unittest.TestCase):
    def test1(self):
        print "Count 1:", TestModel.objects.count()
        m = TestModel(char_field="123456")
        try:
            m.save()
        except Warning:
            print "Count 2:", TestModel.objects.count()
            print "m.id=", m.id
            print "all()[0].id=", TestModel.objects.all()[0].id
-----------------------------------------------------------

manage.py test returns:

Count 1: 0
Count 2: 1
m.id= None
all()[0].id= 1

Which seems like a bug to me (m.id=None). Am I right or I overlooked
some info in documentation?

--
Tomasz Zieliński
http://pyconsultant.eu
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to