Ticket #8548: validate_verbose_name-8548-test.diff

File validate_verbose_name-8548-test.diff, 1.5 KB (added by Marcelo Ramos, 16 years ago)

Patch to add a test in modeltests/invalid_models

  • tests/modeltests/invalid_models/models.py

     
    181181    """ Model to test for unique ManyToManyFields, which are invalid. """
    182182    unique_people = models.ManyToManyField( Person, unique=True )
    183183
     184class VerboseNameTooLong(models.Model):
     185    """ Model to test for verbose_name with invalid lenghts """
     186    name = models.CharField(max_length=10)
     187
     188    class Meta:
     189        verbose_name = 'Lorem ipsum dolor sit amet, consectetur cras amet.'
     190
    184191model_errors = """invalid_models.fielderrors: "charfield": CharFields require a "max_length" attribute.
    185192invalid_models.fielderrors: "decimalfield": DecimalFields require a "decimal_places" attribute.
    186193invalid_models.fielderrors: "decimalfield": DecimalFields require a "max_digits" attribute.
     
    276283invalid_models.abstractrelationmodel: 'fk1' has a relation with model AbstractModel, which has either not been installed or is abstract.
    277284invalid_models.abstractrelationmodel: 'fk2' has an m2m relation with model AbstractModel, which has either not been installed or is abstract.
    278285invalid_models.uniquem2m: ManyToManyFields cannot be unique.  Remove the unique argument on 'unique_people'.
     286invalid_models.verbosenametoolong: verbose_name "Lorem ipsum dolor sit amet, consectetur..." is too long. It must be 39 characters long at most.
    279287"""
Back to Top