[bug 824968] Fix models undefined in monkeypatch.py.
Move some monkeypatching from manage.py to monkeypatch.py