Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I disable /account/register on django-registration?

[Newbie] I tried to disable django-registration by:

1.registration_allowed() I saw this method on the source registration_allowed() /registration/views but I don't know if it's what I need or how to use it.

Maybe I need a variable on settings.py

2.Commenting the lines Commenting the /registration/backends/urls.py register urls (only the lines regarding registration)

But this breaks the urls, so any idea?

Thanks!

like image 301
Mc- Avatar asked Feb 25 '12 18:02

Mc-


2 Answers

Registration actually includes a setting for this called REGISTRATION_OPEN. Simply set it to false in your settings.py file and include a registration/registration_closed.html template.

like image 72
Joel Avatar answered Oct 19 '22 13:10

Joel


Short solution: you can place a reference to your own view in urls.py ABOVE including registration's urls. So your view will intercept the request, and you can do anything you want (i.e. return redirect somewhere else).

Correct solution: write your own registration backend and templates and remove references to the register view from there.

like image 29
ilvar Avatar answered Oct 19 '22 13:10

ilvar