On Friday 15 January 2010 17:08:06 Mike Ramirez wrote:
>  Add in an if statement, one that while cycling through the only_me=True
>  list, ignores the current model you're saving.
> 
>      def save(self):
>          if self.only_me:
>              only_me_true = MyModel.objects.filter(only_me=True)
>              for obj in only_me_true:
>                                       if obj.id != self.id:
>                       obj.only_me = False
>                    obj.save()
>         MyModel.save(self)
> 

Sorry for the bad formatting -- hope this helps.

  def save(self, *args, **kwargs):
    if self.only_me:
      only_me_true = MyModel.objects.filter(only_me=True)
      for obj in only_me_true:
      if obj.id != self.id:
        obj.only_me = False
        obj.save()
    super(MyModel, self).save(*args, **kwargs)


Mike
-- 
What upsets me is not that you lied to me, but that from now on I can no
longer believe you.
                -- Nietzsche

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to