def get_unique_for_date_validators(self):
        """
        Determine a default set of validators for the following contraints:

        * unique_for_date
        * unique_for_month
        * unique_for_year
        """
        info = model_meta.get_field_info(self.Meta.model)
        default_manager = self.Meta.model._default_manager
        field_names = [field.source for field in self.fields.values()]

        validators = []

        for field_name, field in info.fields_and_pk.items():
            if field.unique_for_date and field_name in field_names:
                validator = UniqueForDateValidator(
                    queryset=default_manager,
                    field=field_name,
                    date_field=field.unique_for_date
                )
                validators.append(validator)

            if field.unique_for_month and field_name in field_names:
                validator = UniqueForMonthValidator(
                    queryset=default_manager,
                    field=field_name,
                    date_field=field.unique_for_month
                )
                validators.append(validator)

            if field.unique_for_year and field_name in field_names:
                validator = UniqueForYearValidator(
                    queryset=default_manager,
                    field=field_name,
                    date_field=field.unique_for_year
                )
                validators.append(validator)

        return validators
def get_unique_for_date_validators ( self ) : info = model_meta . get_field_info ( self . Meta . model ) default_manager = self . Meta . model . _default_manager field_names = [ field . source for field in self . fields . values ( ) ] validators = [ ] for field_name , field in info . fields_and_pk . items ( ) : if field . unique_for_date and field_name in field_names : validator = UniqueForDateValidator ( queryset = default_manager , field = field_name , date_field = field . unique_for_date ) validators . append ( validator ) if field . unique_for_month and field_name in field_names : validator = UniqueForMonthValidator ( queryset = default_manager , field = field_name , date_field = field . unique_for_month ) validators . append ( validator ) if field . unique_for_year and field_name in field_names : validator = UniqueForYearValidator ( queryset = default_manager , field = field_name , date_field = field . unique_for_year ) validators . append ( validator ) return validators
Determine a default set of validators for the following contraints:

        * unique_for_date
        * unique_for_month
        * unique_for_year