X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/bd4a5d4671708123a15b7f034508926d68ae71f4..3c26965045e8881acd4d5de8c195e4aa61b95ed1:/migrations/__init__.py diff --git a/migrations/__init__.py b/migrations/__init__.py index e69de29..8904fd2 100644 --- a/migrations/__init__.py +++ b/migrations/__init__.py @@ -0,0 +1,23 @@ +from south.creator.freezer import prep_for_freeze +from django.conf import settings +from django.db import models + + +person_model = getattr(settings, 'PHILO_PERSON_MODULE', 'auth.User') + + +def freeze_person_model(): + try: + app_label, model = person_model.split('.') + except ValueError: + raise ValueError("Invalid PHILO_PERSON_MODULE definition: %s" % person_model) + + model = models.get_model(app_label, model.lower()) + + if model is None: + raise ValueError("PHILO_PERSON_MODULE not found: %s" % person_model) + + return prep_for_freeze(model) + + +frozen_person = freeze_person_model() \ No newline at end of file