# Path: phylocommons/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_text = models.TextField(max_length=5000)
#     
#     def profile_text_html(self):
#         return markdown(self.profile_text, safe_mode=True, enable_attributes=False)


from django.contrib.auth.models import User
from phylocommons.models import UserProfile
'''create_profiles.py

Ordinarily, user profiles will be automatically created when user accounts
are created. In some instances, however (such as automatically creating 
superusers through syncdb) this may not work correctly.

This script will create user profiles for all users that don't have one.

run this script with:

    python manage.py shell
    import create_profiles
'''


 
users = User.objects.all()
for u in users:
     try:
          p = u.get_profile()
     except:

# Path: phylocommons/models.py
# class UserProfile(models.Model):
#     user = models.OneToOneField(User)
#     profile_text = models.TextField(max_length=5000)
#     
#     def profile_text_html(self):
#         return markdown(self.profile_text, safe_mode=True, enable_attributes=False)


# Path: create_profiles.py
from django.contrib.auth.models import User
from phylocommons.models import UserProfile

'''create_profiles.py

Ordinarily, user profiles will be automatically created when user accounts
are created. In some instances, however (such as automatically creating 
superusers through syncdb) this may not work correctly.

This script will create user profiles for all users that don't have one.

run this script with:

    python manage.py shell
    import create_profiles
'''


 
users = User.objects.all()
for u in users:
     try:
          p = u.get_profile()
     except:

          UserProfile(user = u).save()