notorhot/models.py
def clean(self):
        """
        Validates that the winner is one of the :class:`Candidate` instances 
        belonging to this :class:`Competition` and that the competition's 
        category matches both of its candidates' categories.
        """
        if self.winner and self.winner.id not in (self.left.id, self.right.id):
            raise ValidationError(_(u"Winner must be one of the candidates "
                u"offered on left or right."))
        
        try:
            category = self.category
        except CandidateCategory.DoesNotExist:
            category = None
        
        if ((self.left.category != self.right.category) or 
                (category and (self.left.category != category))):
            raise ValidationError(_(u"Both candidates for competition must "
                u"belong to same category as competition."))

        Validates that the winner is one of the :class:`Candidate` instances 
        belonging to this :class:`Competition` and that the competition's 
        category matches both of its candidates' categories.
        
Validates that the winner is one of the :class:`Candidate` instances
belonging to this :class:`Competition` and that the competition's
category matches both of its candidates' categories.
Validates that the winner is one of the : class : ` Candidate ` instances belonging to this : class : ` Competition ` and that the competition ' s category matches both of its candidates ' categories .
def clean(self):
        if self.winner and self.winner.id not in (self.left.id, self.right.id):
            raise ValidationError(_(u"Winner must be one of the candidates "
                u"offered on left or right."))
        try:
            category = self.category
        except CandidateCategory.DoesNotExist:
            category = None
        if ((self.left.category != self.right.category) or 
                (category and (self.left.category != category))):
            raise ValidationError(_(u"Both candidates for competition must "
                u"belong to same category as competition."))
def clean ( self ) : if self . winner and self . winner . id not in ( self . left . id , self . right . id ) : raise ValidationError ( _ ( u"Winner must be one of the candidates " u"offered on left or right." ) ) try : category = self . category except CandidateCategory . DoesNotExist : category = None if ( ( self . left . category != self . right . category ) or ( category and ( self . left . category != category ) ) ) : raise ValidationError ( _ ( u"Both candidates for competition must " u"belong to same category as competition." ) )
Validates that the winner is one of the :class:`Candidate` instances
belonging to this :class:`Competition` and that the competition's
category matches both of its candidates' categories.
Validates that the winner is one of the : class : ` Candidate ` instances belonging to this : class : ` Competition ` and that the competition ' s category matches both of its candidates ' categories .
"""
        Validates that the winner is one of the :class:`Candidate` instances 
        belonging to this :class:`Competition` and that the competition's 
        category matches both of its candidates' categories.
        """
self