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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T03:01:40+00:00 2026-06-13T03:01:40+00:00

When I inherit ModelForm in my ContactForm I get this error, when I had

  • 0

When I inherit ModelForm in my ContactForm I get this error, when I had it so modelform did not inherit from modelform no errors just no form on the html page. I really can’t figure this one out

AttributeError at /addacontact
class Contact has no attribute ‘_meta’

Environment:


Request Method: GET
Request URL: http://127.0.0.1:8000/addacontact

Django Version: 1.4.2
Python Version: 2.7.3
Installed Applications:
('django.contrib.auth',
 'django.contrib.contenttypes',
 'django.contrib.sessions',
 'django.contrib.sites',
 'django.contrib.messages',
 'django.contrib.staticfiles',
 'django.contrib.admin',
 'django.contrib.admindocs',
 'south',
 'sekizai')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
 'django.contrib.sessions.middleware.SessionMiddleware',
 'django.middleware.csrf.CsrfViewMiddleware',
 'django.contrib.auth.middleware.AuthenticationMiddleware',
 'django.contrib.messages.middleware.MessageMiddleware',
 'django.middleware.clickjacking.XFrameOptionsMiddleware')


Traceback:
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/handlers/base.py" in get_response
  89.                     response = middleware_method(request)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/middleware/common.py" in process_request
  67.             if (not urlresolvers.is_valid_path(request.path_info, urlconf) and
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in is_valid_path
  531.         resolve(path, urlconf)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in resolve
  420.     return get_resolver(urlconf).resolve(path)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in resolve
  298.             for pattern in self.url_patterns:
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in url_patterns
  328.         patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/core/urlresolvers.py" in urlconf_module
  323.             self._urlconf_module = import_module(self.urlconf_name)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/utils/importlib.py" in import_module
  35.     __import__(name)
File "/home/brian/projects/steprider/steprider/urls.py" in <module>
  2. from steprider.views import Add_a_contact
File "/home/brian/projects/steprider/steprider/views.py" in <module>
  9. from salesflow.forms import *
File "/home/brian/projects/steprider/salesflow/forms.py" in <module>
  13. class ContactForm(ModelForm):
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/forms/models.py" in __new__
  206.                                       opts.exclude, opts.widgets, formfield_callback)
File "/home/brian/virt_env/virt_step/local/lib/python2.7/site-packages/Django-1.4.2-py2.7.egg/django/forms/models.py" in fields_for_model
  146.     opts = model._meta

Exception Type: AttributeError at /addacontact
Exception Value: class Contact has no attribute '_meta'

this is forms.py

#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
#  steprider.salesflow.forms.py
#  
#  Copyright 2012 BRIAN SCOTT CARPENTER <KlanestroTalisman@gmail.com>

from django.forms import ModelForm
from salesflow import models
from django import forms
from django.template.defaultfilters import slugify

class ContactForm(ModelForm):
    description = forms.CharField(widget=forms.Textarea)

    class Meta:
        model = models.Contact
        exclude = ("user","slug")

    def save(self, user):
        contact = super(ContactForm, self).save(commit=False)
        contact.user = ser
        contact.save()
        return contact

class Contact_History_Form:

    class Meta:
        model = models.Contact_History
        exclude = ("user","slug")

models.py

from django.db import models
from django.contrib.auth.models import User
from django_extensions.db.fields import AutoSlugField



# Create your models here.
class Contact:
    user = models.ForeignKey(User)
    business = models.CharField(max_length=50)
    title = models.CharField(max_length=50)
    name = models.CharField(max_length=50)
    address = models.CharField(max_length=50)
    city = models.CharField(max_length=60)
    state_province = models.CharField(max_length=30)
    country = models.CharField(max_length=50)
    website = models.URLField()
    email = models.EmailField()
    description = models.CharField(max_length=3000)
    slug = models.SlugField(max_length=128)
    slug = AutoSlugField(('slug'), max_length=128, unique=True, populate_from=('business',))


    def __unicode__(self):
        return self.slug


class Contact_History:
    user = models.ForeignKey(User)
    contact = models.ForeignKey('Contact')

    number_of_emails_sent = models.IntegerField()
    last_email_sent = models.DateField()

    phone_notes = models.CharField(max_length=2000)


    slug = models.SlugField(max_length=128)
    slug = AutoSlugField(('slug'), max_length=128, unique=True, populate_from=('name',))


    def __unicode__(self):
        return self.slug
  • 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-13T03:01:41+00:00Added an answer on June 13, 2026 at 3:01 am

    You need to inherit models.Model for your model classes:

    class Contact:
    ...
    

    should be:

    class Contact(models.Model):
    ...
    

    models.Model has _meta attribute, which Contact model will inherit and will be used in when generating ModelForm.

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

Sidebar

Related Questions

Suppose I need to inherit from two classes in C# . This is not
I'm wanting to inherit from System.Web.Security.MembershipProvider - but I require more data than just
If I inherit from a class that is serializable but I specifically do not
Can I Inherit a view in asp.net mvc2 from normal asp.net master page
All my forms inherit from one base form where we handle background paint and
Goal : To inherit from a class with 2 template parameters. Error Error error
I inherit from a root form that has a next and back button in,
My model form inherit from subsystem form. I want to limit choices for the
When I inherit from a class and serialize the new class I get all
I'd like to inherit records, since this is not possible the best solution is

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.