Comments (2)
I'm going to try this and report back:
One is to subclass the built-in form and view classes of django-registration and make the necessary adjustments to achieve compatibility with your user model. For example, if you want to use the two-step activation workflow, but your user model uses a completely different way of marking accounts active/inactive (compared to the the assumed is_active field), you might write subclasses of that workflow’s RegistrationView and ActivationView which make use of your user model’s mechanism for marking accounts active/inactive, and then use those views along with an appropriate subclass of RegistrationForm.
https://django-registration.readthedocs.io/en/3.1.2/custom-user.html#incompatible-user-models
from django-registration.
I've overridden the get_form
method and removed the check. Note that you must have defined a class property form_class
for this to work.
You may choose to implement SOME sort of check rather than no checks at all. For example, by using the __bases__
property to check if your custom user class exists somewhere: form_class._meta.model.__bases__
.
I'm no expert here, of course, but this is where I've started:
def get_form(self, form_class=None):
"""
django-registration checks to see if our custom user model matches the configured user model (from project settings). This doesn't work for our use-case since we have proxy user classes that we want to use. We are overriding this method to skip the check altogether. BE CAREFUL.
"""
if form_class is None:
form_class = self.get_form_class()
return form_class(**self.get_form_kwargs())
Once again, please consider having some sort of check.
from django-registration.
Related Issues (20)
- Best way to resend activation email
- List URL names defined for one-step workflow in quickstart
- django.utils.translation.ugettext_lazy() is deprecated in favor of django.utils.translation.gettext_lazy() HOT 1
- ACCOUNT_ACTIVATION_DAYS not an int HOT 1
- Translation for "Password" does not work HOT 1
- invalid token and site not found
- Is there a function to change email address? HOT 1
- i18n translation doesn't work. HOT 2
- Support for Django 3.2 HOT 2
- ``RegistrationView`` only supports ``ModelForm`` but not conventional forms HOT 1
- Missing documentation on removal of `cleanupregistration` HOT 1
- Migration from 2.x to 3.x leaves `registration` table in database HOT 5
- False ImproperlyConfigured error HOT 2
- Error importing RegistrationView when using custom user model with unique USERNAME_FIELD HOT 7
- E-mail field checked twice for correct format HOT 11
- No rendering in email template HOT 2
- Undocumented assumption about custom user models HOT 1
- Two-step `ActivationView` runs `activate()` on HTTP GET HOT 2
- Python 3.11+ support? HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-registration.