Ok.
Regards,
Chetan Ganji
+91-900-483-4183
ganji.che...@gmail.com
http://ryucoder.in
On Wed, May 6, 2020 at 11:42 AM 'Amitesh Sahay' via Django users <
django-users@googlegroups.com> wrote:
> Hello Chetan,
>
> I got the issue resolved. Below are the correct views:
>
> def userprofileview(reques
Hello Chetan,
I got the issue resolved. Below are the correct views:
def userprofileview(request): # Authenticated user filling the form to
complete the registration
if request.method == 'POST':
form = UserProfileForm(request.POST, request.FILES)
if form.is_valid():
Hello Chetan,
Below is how I have created the forms.
from django.contrib.auth.forms import UserCreationForm
from django.contrib.auth.models import User
from .models import UserProfile
from django import forms
class SignUpForm(UserCreationForm):
email = forms.EmailField()
first_name = for
Hi Chetan,
The default user model already has those three fields, right? And since I have
extended the User as a onetoone field inside the UserProfile model, so
shouldn't that work? I mean, that's my understanding. May be I am wrong. Let me
know, just for the sake of clarity.
Right now I don't
Hi Amitesh,
Assuming you are using model forms in django without any customisation,
as UserProfile model does not have first_name, last_name and email field,
reading the first_name from cleaned_data is failing.
To solve it, you have to add 3 extra fields in the UserProfileForm
i.e. first_name, la
Hello Chetan,
I was doing some random test, so I put "User" there. It is not the part of the
original code.
Below is models.py
from django.db import modelsfrom django.urls import reversefrom
django.contrib.auth.models import User
class UserProfile(models.Model): user = models.OneToOneField(U
Hi Amitesh,
If you post the models, then only someone will be able to give you exact
solution.
Couple of things I noticed.
How is this even working??
You have not defined User variable in the function??
If its the default User model, how would passing it to UserProfile will
help in your scenario?
I have a profile page where I am fetching data from two models. One from the
default User model and another one is custom UserProfile.
However, The data from the custom model is getting populated, but not the User
model.Below are the two functions responsible for the whole procedure.
def userpr
8 matches
Mail list logo