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

  • Home
  • SEARCH
  • 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 9239825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:04:43+00:00 2026-06-18T08:04:43+00:00

I have prepared a basic contact form in Django. The data gets saved successfully.

  • 0

I have prepared a basic contact form in Django. The data gets saved successfully. But I want to retrieve the saved data (all db columns) as a html table and display it on my site (not in the admin interface).

Here is the model:

class ContactForm(forms.Form):
    name = forms.CharField(label='Your name')
    place = forms.CharField(max_length=100,label='Your place')
    message = forms.CharField(label='Your message')
    url = forms.URLField(label='Your Web site', required=False)
    options = forms.BooleanField(required=False)
    day = forms.DateField(initial=datetime.date.today)

The view only accepts the post data and redirects to a “thanks” page.

I tried doing ContactForm.objects.all() but the error I got was: Objects attribute does not exist for ContactForm.

  • 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-18T08:04:44+00:00Added an answer on June 18, 2026 at 8:04 am

    It sounds like you need to create a model. A django model describes a database table and creates the functionality to handle that table with python. If you want to save your data then you’re going to want it saved in the database, and you’re going to want a model for that.

    Try something like –

    from django.db import models
    
    class Contact(models.Model):
        name = models.CharField(label='Your name', max_length=128)
        place = models.CharField(max_length=100,label='Your place')
        message = models.CharField(label='Your message', max_length=128)
        url = models.URLField(label='Your Web site', required=False)
        options = models.BooleanField(required=False)
        day = models.DateField(initial=datetime.date.today)
    

    Then instead of creating a form that inherits from Form you want to inherit from ModelForm (see the docs for more info on Model Forms). It should be pretty simple because all you’re fields are already described on the model –

    from django.forms import ModelForm
    
    class ContactForm(ModelForm):
        class Meta:
            model = Contact
    

    You’ll need a view that will handle saving the form (here’s an example from the docs). Then you’ll be able to do Contact.objects.all() and follow the example from Cathy’s answer to display it. Alternatively, check out Django-Tables2 – a useful plugin for displaying tables.

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

Sidebar

Related Questions

I have basic question about mysqli prepared statements. For example, I want to execute
I have prepared few queries using startwith and connectby for fetching all items of
I have a case where I want to use the results of a prepared
Okay I have a basic task that I want to complete and I could
We have done some basic TCP communication, but have a few questions. We are
I have a c# application (2008) that gets data from sql server (2005). I
I've created two very basic Interfaces named ReaderInterface and WriterInterface, but I have removed
I have a very basic email submission form in my ASP.NET MVC 3 app.
I have prepared one sample application.When application install in devices download the file from
I have prepared a r script and trying to apply the same codes in

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.