Skip to content

blodone/django-registration-rest-framework

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Django Registration Rest Framework

Clone of Django Resgistration flow for Django Rest Framework

Needs 'django.contrib.sites' and an email backend

Based on

StackOverflow answer http://stackoverflow.com/a/19337404

and

django-registration https://django-registration.readthedocs.org/

Install

$ git clone [email protected]:tucarga/django-registration-rest-framework.git

$ pip install -e django-registration-rest-framework

Usage

settings.py

INSTALLED_APPS =
...
'registration_api',
...

# This setting is mandatory
REGISTRATION_API_ACTIVATION_SUCCESS_URL = '/'
REGISTRATION_API_USER_DATA_MAPPING = ('email', 'first_name', 'last_name', 'password')
REGISTRATION_API_USER_REGISTER_DATE_FIELD = 'created'

REGISTRATION_API_USER_SERIALIZER = 'registration_api.serializers.UserSerializer'

urls.py

urlpatterns = patterns(
...
url(r'^accounts_api/', include('registration_api.urls')),
url(r'^activate/', include('registration_api.activate_urls')),
...
)

Front-end

From your front-end or mobile application send a post to the register url 'accounts_api/register/'. The fields depends on your AUTH_USER_MODEL but should be something like

[{"username": "john", "email": "[email protected]", "password": "verylongpassword"}]

This will trigger an email to the addess specified by the user. When the user follows the link the account is activated.

Test

$ python tests/runtests.py [TestsCase[.test_method]]

or

$ python setup.py test

About

Registration for Django Rest Framework

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%