Permalink
Browse files

Only install UserProfile when User is created if Minerva is installed.

Closes issue gh-17.
  • Loading branch information...
malcolmt committed Sep 27, 2010
1 parent e0f1629 commit db2e4048a43228fdf65b3dcd8305b70ec2f4b2db
Showing with 6 additions and 0 deletions.
  1. +6 −0 minerva/signal_handlers.py
@@ -1,9 +1,15 @@
+from django.contrib.contenttypes.models import ContentType
def create_user_profile(sender, **kwargs):
"""
Create an empty UserProfile whenever a new User is created.
"""
from minerva import models
+ try:
+ ContentType.objects.get_by_natural_key("minerva", "userprofile")
+ except ContentType.DoesNotExist:
+ # Minerva app hasn't been installed yet.
+ return
if not kwargs["created"]:
return
models.UserProfile(student=kwargs["instance"]).save()

0 comments on commit db2e404

Please sign in to comment.