Ticket #7634: auto_add.diff

File auto_add.diff, 763 bytes (added by Alex Gaynor, 9 years ago)

Raises a deprecation warning

  • django/db/models/fields/__init__.py

    diff --git a/django/db/models/fields/__init__.py b/django/db/models/fields/__init__.py
    index 1eefed6..44592d7 100644
    a b class DateField(Field): 
    533533        self.auto_now, self.auto_now_add = auto_now, auto_now_add
    534534        #HACKs : auto_now_add/auto_now should be done as a default or a pre_save.
    535535        if auto_now or auto_now_add:
     536            import warnings
     537            warnings.warn("auto_add and auto_add_now are going to be deprecated, you should use default or overide save instead", DeprecationWarning, stacklevel=2)
    536538            kwargs['editable'] = False
    537539            kwargs['blank'] = True
    538540        Field.__init__(self, verbose_name, name, **kwargs)
Back to Top