On Oct 1, 7:30 am, cschand <[EMAIL PROTECTED]> wrote: > Hello all, > I have a problem with get objects from User > > when i give > user = User.objects.get(email='[EMAIL PROTECTED]') > > if only one data is there it is executing ok... but if there are two > or more it showing and AssertionError > get() returned more than one User -- it returned 2! > > Is there any way to limit to return only one data.. ? > > thanks in advance > cschand
Do you not mind which of the records with the duplicate email is returned? If so, this would work: User.objects.filter(email="[EMAIL PROTECTED]")[0] -- DR. --~--~---------~--~----~------------~-------~--~----~ 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---