Re: reg: User model data missing from web page

2020-05-06 Thread Chetan Ganji
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

Re: reg: User model data missing from web page

2020-05-05 Thread 'Amitesh Sahay' via Django users
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():

Re: reg: User model data missing from web page

2020-05-05 Thread 'Amitesh Sahay' via Django users
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

Re: reg: User model data missing from web page

2020-05-05 Thread 'Amitesh Sahay' via Django users
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

Re: reg: User model data missing from web page

2020-05-05 Thread Chetan Ganji
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

Re: reg: User model data missing from web page

2020-05-05 Thread 'Amitesh Sahay' via Django users
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

Re: reg: User model data missing from web page

2020-05-05 Thread Chetan Ganji
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?

reg: User model data missing from web page

2020-05-05 Thread 'Amitesh Sahay' via Django users
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