HI,
You can create a custom model like this and define all custom fields within 
it:
class UserInfo(AbstractTimestampClass):
    user = models.ForeignKey(User)
    address = models.TextField(blank=True, null=True)
    city = models.CharField(max_length=25, blank=True, null=True)
    postal_code = models.CharField(max_length=20, blank=True, null=True)
    state = models.CharField(max_length=40, blank=True, null=True)
    country = models.CharField(max_length=100, blank=True, null=True)
    company = models.CharField(max_length=100, blank=True, null=True)
    phone = models.CharField(max_length=25, blank=True, null=True)
    fax = models.CharField(max_length=25, blank=True, null=True)

Note the above model is referring to the in built User model through 
foreign key relationship.
On registration API you would need to create both User and UserInfo objects.
Something like:
user = User.objects.create_user(username=validated_data['email'],
                                        email=validated_data['email'],
                                        
password=validated_data['password'],)
UserInfo.objects.create(user=user,
                                address=validated_data['address'],
                                city=validated_data['city'],etc.)
That would suffice.

On Wednesday, June 8, 2016 at 4:19:31 PM UTC+5:30, Arshpreet Singh wrote:
>
> I am implementing Django User registration method as provided in the 
> following tutorial: 
>
>
> https://mayukhsaha.wordpress.com/2013/05/09/simple-login-and-user-registration-application-using-django/
>  
>
> It is not using any model/model-form, But I want to connect with 
> User-registration with other defined model. 
>
> Is it possible using the above tutorial or I have to create new 
> UserRegistration model? 
>
> -- 
>
> Thanks 
> Arshpreet Singh 
> Python Developer 
> RevinfoTech 
> Web Development/Data Science/Systems Integration 
> Mobile: (91)987 6458 387 
> http://www.revinfotech.com/ 
> https://www.linkedin.com/in/arsh840 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/cf5cdce9-f4ab-4605-96f6-d02496b00b45%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to