Commit 6b4357e8 authored by Jean-Baptiste Pasquier's avatar Jean-Baptiste Pasquier

Merge branch 'name-registration-form' into 'master'

Configurable fields in Registration form

See merge request !45
parents a7584d46 86474e60
Pipeline #7308 failed with stage
in 46 seconds
......@@ -59,6 +59,11 @@ EMAIL_HOST_PASSWORD = 'password'
EMAIL_PORT = 587
```
Optionally you can configure which user fields which you would like to include on the registration form by including `REGISTRATION_FIELDS` in settings.py
```python
REGISTRATION_FIELDS = ('username', 'email', 'password1', 'password2')
```
The workflow starts at : http://127.0.0.1:8000/accounts/register/
Then, override template by copying the directory `djangoldp_account/templates/django_registration/` to your project and modify them.
......
......@@ -4,6 +4,13 @@ from django_registration.forms import RegistrationForm
from djangoldp_account.models import LDPUser
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'))
class LDPUserForm(RegistrationForm):
class Meta(RegistrationForm.Meta):
model = get_user_model()
fields = _get_user_form_fields()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment