On Jan 21, 6:31 pm, Chris Seberino <cseber...@gmail.com> wrote: > On Jan 21, 6:44 am, Tom Evans <tevans...@googlemail.com> wrote: > > > Models are representations of rows in a database. > > Deleting a model instance implies removing a row from a database. > > Model instances have an id attribute which denotes their row in the > > database. > > Models whose id is None don't exist in the database, and so it is > > nonsense to delete them - they don't exist.
This should read "they don't exist _in the database_" - a model instance is not a database row, it's a python object. The database row only exists if and when the model instance has been saved, and until the database row is deleted. > That makes perfect sense but then why do these zombie id=None objects > show up? That's one question... And I don't have the answer. > *WHERE* are they living if not in the database? Does the Django shell > somehow have a secondary storage area for this zombie id=None object > stuff I can delete somehow? And that's another question, which has a very simple answer: model instances live in your python process (django's dev server, wsgi process, custom management command, django shell or whatever). If you fire a django shell, import your model class and instanciate it directly and don't save it you will have a model instance with no id (assuming you're using the auto id field which is the default). -- 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.