<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0"
					xmlns:content="http://purl.org/rss/1.0/modules/content/"
					xmlns:wfw="http://wellformedweb.org/CommentAPI/"
					xmlns:dc="http://purl.org/dc/elements/1.1/"
				  >
<channel>
<title>NEVERFEAR (Post Comments)</title>
<link>http://neverfear.org</link>
<description><![CDATA[NEVERFEAR.org weblog feed for post comments]]></description>
<image><title>NEVERFEAR (Post Comments)</title>
<link>http://neverfear.org</link>
<url>http://neverfear.org/favicon.ico</url>
</image>
<language>en-uk</language>
<pubDate>Wed, 29 Apr 2026 09:15:41 +0000</pubDate>
<item>
<title>Comment on Auto Generate Forms With Django's ModelForm</title>
<link>http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_1738</link>
<pubDate>Thu, 31 Jan 2013 10:00:42 +0000</pubDate>
<description><![CDATA[<h4>model using ModelForm: models.py</h4>

<p>from django.db import models
from django.forms import ModelForm</p>

<p>class customers(models.Model):
    name = models.CharField(max_length=50)
    custAdd = models.TextField()</p>

<pre class="text" style="font-family:monospace;">class Meta:
    db_table = 'tb_amit_test'
    ordering = ['-name']
    verbose_name_plural = 'customers'
&nbsp;
def __unicode__(self):
    return self.name
&nbsp;
@models.permalink
def get_absolute_url(self):
    return ('customers_customers', (), { 'customers_name': self.name })</pre>

<p>class customerForm(ModelForm):
    class Meta:
        model=customers</p>

<h4>View:views.py</h4>

<p>from django.shortcuts import render_to_response
from mtcc_customer_db import customers
from mtcc_customer_db import customerForm
from django.template import RequestContext</p>

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

<h4>URLs:</h4>

<p>from django.conf.urls import patterns, include, url
from mtcc_customer_db import settings
from django.contrib import admin
admin.autodiscover()</p>

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

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

<h3>Template: customer.html</h3>

<p>{% extends "base.html" %}</p>

<p>{% block site_wrapper %}</p>

<p>&lt;</p>

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

<pre class="text" style="font-family:monospace;">    &lt;a href=&quot;#content&quot; class=&quot;skip_link&quot;&gt;Skip to main content&lt;/a&gt;
    &lt;form action=&quot;.&quot; method=&quot;post&quot;&gt;
    &lt;input type=&quot;text&quot; name=&quot;name&quot; id=&quot;name&quot; value=&quot;{{name}}&quot;&gt;
     &lt;input type=&quot;text&quot; name=&quot;custAdd&quot; id=&quot;custAdd&quot; value=&quot;{{custAdd}}&quot;&gt;
     &lt;input type=&quot;submit&quot; value=&quot;Submit&quot;&gt;
    &lt;/form&gt;.........</pre>

<p>{% endblock %}</p>

<p>I am getting the error in the browser:</p>

<p>Request Method:     GET
Request URL:    http://127.0.0.1:8000/customers/
Django Version:     1.4.3
Exception Type:     ImportError
Exception Value:</p>

<p>cannot import name customerForm</p>

<p>Where am i going wrong?? Please help</p>
]]></description>
<author>amit</author>
<guid isPermaLink="true" >http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_1738</guid>
</item>
<item>
<title>Comment on Auto Generate Forms With Django's ModelForm</title>
<link>http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_213</link>
<pubDate>Wed, 17 Aug 2011 15:46:56 +0000</pubDate>
<description><![CDATA[<p>This works!  Thanks for sharing.</p>
]]></description>
<author>fourcs</author>
<guid isPermaLink="true" >http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_213</guid>
</item>
<item>
<title>Comment on Auto Generate Forms With Django's ModelForm</title>
<link>http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_196</link>
<pubDate>Thu, 19 May 2011 17:35:40 +0000</pubDate>
<description><![CDATA[<p>Thanks a lot! Examples always help.. :)</p>
]]></description>
<author>Rishab</author>
<guid isPermaLink="true" >http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_196</guid>
</item>
<item>
<title>Comment on Auto Generate Forms With Django's ModelForm</title>
<link>http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_186</link>
<pubDate>Thu, 03 Mar 2011 19:16:24 +0000</pubDate>
<description><![CDATA[<pre class="text" style="font-family:monospace;"> ip = forms.IPAddressField )</pre>

<p>You should correct this line.</p>
]]></description>
<author>Neo</author>
<guid isPermaLink="true" >http://neverfear.org/blog/view/123/Auto_Generate_Forms_With_Django__s_ModelForm_/comments#comment_186</guid>
</item>
</channel>
</rss>