Ticket #16694: 16694.patch

File 16694.patch, 1.1 KB (added by Aymeric Augustin, 13 years ago)
  • tests/modeltests/invalid_models/invalid_models/models.py

     
    55This example exists purely to point out errors in models.
    66"""
    77
    8 from django.db import models
     8from django.db import connection, models
    99
    1010class FieldErrors(models.Model):
    1111    charfield = models.CharField()
     
    342342invalid_models.nonexistingorderingwithsingleunderscore: "ordering" refers to "does_not_exist", a field that doesn't exist.
    343343invalid_models.invalidsetnull: 'fk' specifies on_delete=SET_NULL, but cannot be null.
    344344invalid_models.invalidsetdefault: 'fk' specifies on_delete=SET_DEFAULT, but has no default value.
    345 invalid_models.primarykeynull: "my_pk_field": Primary key fields cannot have null=True.
    346345"""
     346
     347if not connection.features.interprets_empty_strings_as_nulls:
     348    model_errors += """invalid_models.primarykeynull: "my_pk_field": Primary key fields cannot have null=True.
     349"""
Back to Top