vandersonmota/model_mommy — pull request #61 by henriquebastos (2012-12-23 12:19:53+00:00)
Title: Align with Django 1.4+ timezone aware datetime

Running *model_mommy* with Django 1.4+ generates `RuntimeWarning` whenever a DateTimeField is persisted.

This relates to [Django 1.4+ using timezone aware datetime](https://docs.djangoproject.com/en/1.4/topics/i18n/timezones/) if setting `USE_TZ = True`.

### Reproducing the problem

To reproduce the problem fixed by this patch, do before apply it:

1. add the following lines to `model_mommy/tests/test_settings.py`:

```python
USE_TZ = True
import warnings
warnings.filterwarnings(
'error', r"DateTimeField received a naive datetime",
RuntimeWarning, r'django\.db\.models\.fields')
```

2. run `./runtests.py`

3. Observe the warnings:

> RuntimeWarning: DateTimeField received a naive datetime (2012-12-22 20:07:34.822169) while time zone support is active.

### Future changes to the test env

*model_mommy* now needs to be tested against multiple environments, which can be done with [tox](http://testrun.org/tox/latest//example/basic.html):

1. Django 1.3-
2. Django 1.4+ with `USE_TZ = False`
3. Django 1.4+ with `USE_TZ = True`.

PS: I wasn't sure about adding it here, so I'll submit it in a different patch.