On 7/25/06, wnielson <[EMAIL PROTECTED]> wrote: > if not self.genres.all(): > try: > > genre=Genre.objects.get(name='default') #default genre > except: > genre=Genre(name='default') > genre.save() > self.genres.add(genre) #this doesn't appear > to be called through
I'm not 100% certain, but I *think* the problem is that self.genres.all() will always evaluate True in this context, even when there are no items in it -- you haven't done anything which will force the QuerySet to be evaluated by checking the DB. What happens if you change it to 'if not self.genres.all().count()' ? -- "May the forces of evil become confused on the way to your house." -- George Carlin --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@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-developers -~----------~----~----~----~------~----~------~--~---