forms.py 551 Bytes
Newer Older
1 2 3 4 5 6
from django.contrib.auth import get_user_model

from django_registration.forms import RegistrationForm
from djangoldp_account.models import LDPUser


7 8 9 10 11 12
def _get_user_form_fields():
    '''Gets the fields required for the form from settings, or returns default'''
    from django.conf import settings
    return getattr(settings, 'REGISTRATION_FIELDS', ('username', 'email', 'password1', 'password2'))


13 14 15
class LDPUserForm(RegistrationForm):
    class Meta(RegistrationForm.Meta):
        model = get_user_model()
16
        fields = _get_user_form_fields()