On Tue, Jan 5, 2010 at 5:52 PM, Aristotle Miternan <hypersp...@gmail.com> wrote: > Hello everyone, > > The latest update to django 1.2 broke my code and I'm hesitant to > post it as a bug when I'm not sure if there's a core concept that > changed that I don't get. > > I noticed that I am no longer able to do this: > > class Foo(models.Model): > foo = models.CharField(max_length=30) > > def __unicode__(self): > return u"%s" % foo > > > print Foo() > > > I am getting a DoesNotExist exception when I haven't even touched > the database yet!
I don't see this error with your sample code and r12103. However, I *do* see a NameError - because your __unicode__ method references foo, not self.foo. > Some of my code depends on this behavior (ie foo.save > (commit=False) ) so I can patch it with data that's not supposed to be > defined by the user after it comes out of a modelform. Perhaps my > technique is weak, but nonetheless I find this behavior strange. > > Is it just me? I suspect there is something else going on. Foo() should be instantiating an empty object. It shouldn't be performing any database queries. Printing Foo() shouldn't be performing any database queries, either. I don't doubt that you're seeing an error, but the cause isn't as simple as you describe. Yours, Russ Magee %-) -- You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-us...@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.