Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8540843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T11:41:35+00:00 2026-06-11T11:41:35+00:00

I am developing an app which consists of multiple models. In my 2nd model

  • 0

I am developing an app which consists of multiple models. In my 2nd model in model.py it consist of 2-3 col. of char field but in my template when I am using this {{ form.billing_add }} then it doesn’t show any text input in browser

my model.py file is as

from django.db import models
from django.contrib.auth.models import User

class Customer(models.Model):
    user        =models.OneToOneField(User)
    birthday    =models.DateField()
    website     =models.CharField(max_length=50)
    store       =models.CharField(max_length=50)
    welcomemail =models.CharField(max_length=50)

    def __unicode__(self):
             return self.user

class Customer_check_attributes(models.Model):
    customer    = models.ForeignKey(Customer)
    billing_add =models.CharField(max_length=50)
    shipping_add    =models.CharField(max_length=50)
    payment_method  =models.CharField(max_length=50)
    shipping_method =models.CharField(max_length=50)
    reward_points   =models.CharField(max_length=50)

and my form.py file as

from django import forms
from django.contrib.auth.models import User
from django.forms import ModelForm
from customer_reg.models import Customer,Customer_check_attributes

class Registration_Form(ModelForm):
       first_name  = forms.CharField(label=(u'First Name'))
       last_name   = forms.CharField(label=(u'Last Name'))      
       username   = forms.CharField(label=(u'User Name'))
       email      = forms.EmailField(label=(u'Email Address'))
       password   = forms.CharField(label=(u'Password'), widget=forms.PasswordInput(render_value=False))

       class Meta:
              model=Customer

              exclude=('user',)
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T11:41:36+00:00Added an answer on June 11, 2026 at 11:41 am

    It seems that you want to have a html form which has attributes from multiple models.
    So the way would be to create separate form for each model but show it on one page through one view and template and process it in the same.

    Here is example

    forms

    #additional user attributes 
    class Registration_Form(ModelForm):
         first_name  = forms.CharField(label=(u'First Name'))
         last_name   = forms.CharField(label=(u'Last Name'))      
         username   = forms.CharField(label=(u'User Name'))
         email      = forms.EmailField(label=(u'Email Address'))
         password   = forms.CharField(label=(u'Password'), widget=forms.PasswordInput(render_value=False))
         class Meta:
             model = User
    
    class CustomerForm(ModelForm):
         class Meta:
             model = Customer
             exclude=('user',)
    
    class Customer_check_attributesForm(ModelForm):
         class Meta:
             model = Customer_check_attributes
             exclude=('user',)
    

    view:

    def customer_add(request):
        if request.method == 'POST':
             uform = Registration_Form(request.POST)
             cform = CustomerForm(request.POST)
             caform = Customer_check_attributesForm(request.POST)
             if uform.is_valid() :
                 ...
                 user = uform.save()
             if cform.is_valid() :
                 ...
                 customer = cform.save()
             if caform.is_valid() :
                 ...
                 cattr = caform.save()
      else:
          uform = Registration_Form()
          cform = CustomerForm()
          caform = Customer_check_attributesForm()         
      ctx = { 'uform': uform, 'cform':cform, 'caform': caform }
        return render_to_response('add_customer_template.html', ctx,
                    context_instance = RequestContext(request))
    

    Sample add_customer_template.html

     <form> 
         {#other rendering logic#}
         {{ uform.as_p }}
         {{ cform.as_p }}
         {{ caform.as_p }}
     </form>
    

    Note: this is a guideline code. There is scope for improvement to handle errors and better logic.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i am developing an app which has a evernote integration,everything works perfect but my
I was developing app which uses Facebook API authentication for user login. But sometimes
Am developing an app which am using a dashboard. I want the dashboard to
Im developing an app which uses the tcp connection. currently im communicating using hard
Hi i am developing app in which there will be multiple tables in single
I'm currently developing an app which plays an audio file (mp3, but can change
I'm developing an app which uses a custom font but I'm experiencing some unusual
I am developing a native app which consists of some mathematical formulas. Formulas will
Hello I am developing an app which is using a tableview with two sections(instead
im currently developing an app which plays the steam audio using MediaPlayer class. And

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.