I have been struggling with implementing different answers to handle (e.g. Django-Registration & Django-Profile, using your own custom form) but have not managed to get this to work in my project because it seems too out of date.
Essentially I have installed Django-Registration in my project and can have the User authenticated and created via this.
However, I have extended the User with the following UserProfile model:
class UserProfile(models.Model):
user = models.OneToOneField(User, on_delete=models.CASCADE)
account_type = models.IntegerField(null = True, default= 1)
daily_message = models.BooleanField(default = True)
tel_number = models.CharField(max_length=20, null = True)
def __str__(self):
return str(self.user)
And I would like that either:
- UserProfile with default/null values is created for each user (user can update this later)
- User is able to enter a telephone number with other details on registration.
The following is hooked up in my URLs.py:
urlpatterns = [
url(r'^admin/', admin.site.urls),
url(r'^accounts/', include('registration.backends.hmac.urls')),
url(r'^', include('app.urls'))
]
As I have no visibility over any of the Django-registration forms and a lot of the documentation describes a custom user model (which I do not have), any ideas how I could do one of the above?