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 9218771
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T02:56:24+00:00 2026-06-18T02:56:24+00:00

#### model using ModelForm: models.py from django.db import models from django.forms import ModelForm class

  • 0
#### model using ModelForm: models.py
from django.db import models
from django.forms import ModelForm

class customers(models.Model):
    name = models.CharField(max_length=50)
    custAdd = models.TextField()

    class Meta:
            db_table = 'tb_amit_test'
            ordering = ['-name']
            verbose_name_plural = 'customers'

    def __unicode__(self):
            return self.name

    @models.permalink
    def get_absolute_url(self):
            return ('customers_customers', (), { 'customers_name': self.name })

class customerForm(ModelForm):
    class Meta:
            model=customers


#### View:views.py

from django.shortcuts import render_to_response
from mtcc_customer_db import customers
from mtcc_customer_db import customerForm
from django.template import RequestContext


def adddata(request):
    if request.method == 'POST':
            f=custform(request.POST)
            if f.is_valid():
                    newcust=f.save(commit=False)
                    newcust.save()
            return HttpResponseRedirect('/')
    return render_to_response('index.html',
context_instance=RequestContext(request))

#### URLs:
from django.conf.urls import patterns, include, url
from mtcc_customer_db import settings
from django.contrib import admin
admin.autodiscover()

urlpatterns = patterns('',
# Uncomment the next line to enable the admin:
 url(r'^admin/', include(admin.site.urls)),)

urlpatterns +=patterns('mtcc_customer_db.customers.views',
(r'^customers/$', 'adddata'),)

### Template: customer.html

{% extends "base.html" %}

{% block site_wrapper %}
    <div id="main">
    {% include "tags/navigation.html" %}

    <a href="#content" class="skip_link">Skip to main content</a>
    <form action="." method="post">
    <input type="text" name="name" id="name" value="{{name}}">
     <input type="text" name="custAdd" id="custAdd" value="{{custAdd}}">
     <input type="submit" value="Submit">
    </form>.........
{% endblock %}

I am getting the error in the browser:

Request Method: GET
Request URL: someaddress.customers/
Django Version: 1.4.3
Exception Type: ImportError
Exception Value:

—>>cannot import name customerForm

Where am i going wrong?? Please help

  • 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-18T02:56:25+00:00Added an answer on June 18, 2026 at 2:56 am

    Try this:

    from your_module_name.models import customerForm
    

    in your views.py file

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

Sidebar

Related Questions

I'm using django extra views: # views.py from django.forms.models import inlineformset_factory from extra_views import
Code: Model: class Machines(models.Model): name = models.CharField(max_length=100, verbose_name=hostname, help_text=Host name of the machine) ip_addr
Consider these 3 models: # models.py class City(models.Model): name = models.CharField(max_length=50) class Institute(models.Model): name
I have a model: class Server(models.Model): serverId = models.IntegerField(verbose_name=_(serverId)) name = models.CharField(max_length=200, verbose_name=_(server_name)) ip
Taking a classic foo bar example: In models.py : Class Foo(models.Model): name = models.CharField(max_length=
I'm using a modelform for User like so: class UserForm(forms.ModelForm): class Meta: model =
I have the following code: from django import forms from django.core.exceptions import ValidationError class
Model: using System.ComponentModel.DataAnnotations; using MySite.Validators; namespace MySite.Models { public class AddItem { [Required(ErrorMessage =
I have a model with a get_form method. # models.py from model_utils.managers import InheritanceManager
Am using django forms on my app. I have a model Client like this:

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.