models.py 425 B

123456789101112131415
  1. # -*- coding: utf-8 -*-
  2. from __future__ import unicode_literals
  3. from django.core import checks
  4. from django.db import models
  5. class ModelRaisingMessages(models.Model):
  6. @classmethod
  7. def check(self, **kwargs):
  8. return [
  9. checks.Warning('First warning', hint='Hint', obj='obj'),
  10. checks.Warning('Second warning', obj='a'),
  11. checks.Error('An error', hint='Error hint'),
  12. ]