X-Git-Url: http://git.ithinksw.org/philo.git/blobdiff_plain/98bd3a178f3e62e5591e809ac61e07a5bf37c292..1422f0d2c8325b2c4d6781bd3c7b21a3d5873b90:/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