Preserve timestamps when loading the database from serialized data

Review Request #21 — Created May 21, 2007 and submitted

Review Board SVN (deprecated)
Due to our usage of auto_now and auto_now_add in the DateTimeFields, any load of a DB dump would cause all timestamps to be reset to The Django people recognize this as a problem and are planning to phase out these parameters and add new fields for making this work better when serialized. For now, though, instead of auto_now, we provide a ModificationTimestampField, which sets now() only when the model is first being saved to the database or when the value of the field is None.

auto_now_add has been replaced with, which is what's recommended and being used in Django. It provides the same functionality as auto_now_add=True, but allows the value to be replaced (making it properly load from serialized dumps).
Created some new review requests. Saw the correct timestamps for creation.

Updated the review requests and saw that the last_updated field was set correctly.

Dumped the database and reloaded. Saw that the timestamps were preserved.

Did a little dance. Didn't make a little love, though.
  2. /trunk/reviewboard/utils/ (Diff revision 1)
    Add a blank line above this
  3. /trunk/reviewboard/utils/ (Diff revision 1)
    I've read through this four times and can't figure out what it means.  Maybe just my sleep-deprived state.  Perhaps there's a better way to phrase this?
    1. Yeah. I think it made sense in my twisted mind at the time. It's a bit better now, I think.
  4. /trunk/reviewboard/utils/ (Diff revision 1)
    Can you write this as:
        'editable': False,
        'blank': True,
    instead?  I think that makes it clearer what we're doing here.