On Thu, Jan 16, 2014 at 5:23 PM, Johannes Schneider <johannes.schnei...@galileo-press.de> wrote: > This could be a way to it, but we need this information while handling the > Pre_save singal. So this does not work too.
Abuse the django model instance's internals and look to see what database this instance was loaded from - if it is None, it hasn't come from the database. This is highly fragile - using an undocumented API that I know has changed in recent versions. Personally I would test that the pk does not exist in the database (and buy faster hardware.) >>> u=User.objects.get(id=1) >>> u2=User() >>> u._state.db 'default' >>> u2._state.db >>> Cheers Tom -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAFHbX1JYsE58wL9phRtabVN1RTcEL07PBGwnHHhPE6uUNi2y%3DQ%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.