# 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 import forms
from phylocommons.models import UserProfile


class ProfileForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(ProfileForm, self).__init__(*args, **kwargs)
        try:
            self.fields['email'].initial = self.instance.user.email
            # self.fields['first_name'].initial = self.instance.user.first_name
            # self.fields['last_name'].initial = self.instance.user.last_name
        except User.DoesNotExist:
            pass
 
    email = forms.EmailField(label="E-mail (not shown)", help_text='')
 
    class Meta:

# 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: phylocommons/forms.py
from django import forms
from phylocommons.models import UserProfile



class ProfileForm(forms.ModelForm):
    def __init__(self, *args, **kwargs):
        super(ProfileForm, self).__init__(*args, **kwargs)
        try:
            self.fields['email'].initial = self.instance.user.email
            # self.fields['first_name'].initial = self.instance.user.first_name
            # self.fields['last_name'].initial = self.instance.user.last_name
        except User.DoesNotExist:
            pass
 
    email = forms.EmailField(label="E-mail (not shown)", help_text='')
 
    class Meta:

      model = UserProfile