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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T04:39:50+00:00 2026-05-24T04:39:50+00:00

I want to have a user submitted form in a certain page. My model

  • 0

I want to have a user submitted form in a certain page. My model is like this

class Ask(models.Model):
    name = models.CharField(max_length=500)
    designation = models.CharField(max_length=200, blank=True)
    email = models.EmailField()
    phone = models.CharField(max_length=20,  blank=True)
    avatar = models.ImageField(upload_to="/ask/users/avaters", blank=True)
    question = models.CharField(max_length= 1024)
    ques_time = models.DateField()
    answere = models.TextField()
    ans_time = models.DateField()
    display = models.BooleanField()
    asker_ip = models.CharField(max_length=100)

From user I will receive name, designation, email, phone, avater and question. ques_time and ans_time will automatically update in that time. Answer will be filled from site owner in the django admin. asker_ip will be automatically received from browser ip address.

I have a basic template in the template section. When the form submitted user will redirect to that page but with a success message in the form portion. BTW I want user to upload that avater image.

Now how should I start on this topic. If you can just describe how to start writing or send me an url that would be helpful.

  • 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-05-24T04:39:51+00:00Added an answer on May 24, 2026 at 4:39 am

    you can do something like this:

    • create a view that validates the form like this: if there’s a POST (so, user submitted a form) he creates a form object with all the submitted values in it, then you can manipulate. if there’s no POST request, it simply creates an empty form for the template. both ways, the view returns a form to the template. maybe use another variable set to True/False if form has been submitted or it’s empty.
    • in the template, you can check with template tags if the form exists (with the variable) or not, with something like:

      {% if form_sent %}

      Bravo! You submitted something

      {% else %}
      {{ form.as_p }}
      {% endif %}

    something like this. this should cover the first part of your question.
    This is what you’re looking for files upload. Read this page very carefully, if you miss something, the upload won’t go (ie, i never remember to include the correct mimetype into the form, and i always get errors)

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

Sidebar

Related Questions

I have a form on my page, and I want to send the user
Say I have this simple form: class ContactForm(forms.Form): first_name = forms.CharField(required=True) last_name = forms.CharField(required=True)
I have a form like this: index.php <form method=post action=send.php> <textarea name=msg id=msg></textarea> <input
I have some user-submitted variables that I want to display in a different part
I'm working on a resource management class and want to have the user provide
I have a file field in my form. I want the user to be
Say I have a form like: class GeneralForm(forms.Form): field1 = forms.IntegerField(required=False) field2 = forms.
I have a page that loads different forms depending on user choice. I want
I have a form a user fills in and the action page it goes
I have a form for that a user fills out and submits. Once submitted

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.