<s> from __future__ import unicode_literals <EOL> from django . core . exceptions import ValidationError <EOL> from django . utils . translation import ugettext as _ <EOL> def validate_users ( form , field = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> local_site = form . cleaned_data [ '<STR_LIT>' ] <EOL> users = form . cleaned_data . get ( field , [ ] ) <EOL> if local_site : <EOL> for user in users : <EOL> if not user . local_site . filter ( pk = local_site . pk ) . exists ( ) : <EOL> raise ValidationError ( <EOL> [ _ ( "<STR_LIT>" ) <EOL> % user . username ] ) <EOL> return users <EOL> def validate_review_groups ( form , field = '<STR_LIT>' ) : <EOL> """<STR_LIT>""" <EOL> groups = form . cleaned_data . get ( field , [ ] ) <EOL> local_site = form . cleaned_data [ '<STR_LIT>' ] <EOL> for group in groups : <EOL> if group . local_site != local_site : <EOL> raise ValidationError ( <EOL> [ _ ( "<STR_LIT>" ) % group . name ] ) <EOL> return groups </s>
