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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T17:56:35+00:00 2026-05-20T17:56:35+00:00

1] I have the following model: class UserReportedData(db.Model): #country selected by the user, this

  • 0

1] I have the following model:

class UserReportedData(db.Model):
  #country selected by the user, this will also populate the drop down list on the html page
  country = db.StringProperty(default='Afghanistan',choices=['Afghanistan'])
  #city selected by the user
  city = db.StringProperty()
  user_reported_boolean = db.BooleanProperty() # value that needs to be hidden from the display 
  date = db.DateTimeProperty(auto_now_add=True)

class UserReportedDataForm(djangoforms.ModelForm):

  class Meta:
    model = UserReportedData

2] The html code which will decide the boolean “user_reported_boolean” looks like follows

 '<input type="submit" name="report_up" value= "Report Up">'
 '<input type="submit" name="report_down" value= "Report Down">'

3] The idea is if “report_up” is pressed, the boolean value “user_reported_boolean” should be saved as true

4] The code that gets the call, when the user submits looks like follows

class UserReporting(webapp.RequestHandler):

  def post(self):
    #get the data that the user put in the django form UserReportForm
    data = UserReportedDataForm(data=self.request.POST)

    #need to find whether user hit the button with the name "report_up" or "report_down"
    # this is not working either
    if 'report_up' in self.request.POST:
        data.user_reported_boolean = True
    elif 'report_down' in self.request.POST:
        data.user_reported_boolean = False    

    if data.is_valid():
        # Save the data, and redirect to the view page
        entity = data.save(commit=False)
        entity.put()
        self.redirect('/')

Questions:

1] How do i hide the field “user_reported_boolean” from being displayed on the html form

2] How do i save this field “user_reported_boolean” in the database

  • 1 1 Answer
  • 3 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-20T17:56:35+00:00Added an answer on May 20, 2026 at 5:56 pm

    1: Exclude the field from your modelform.

    class MyModelForm(ModelForm):
        class Meta:
             model = Foo
             exclude = ('myfield',)
    

    2: In the unsaved model instance you have via commit=False

    entity = data.save(commit=False)
    entity.user_reported_boolean = True # False, whatever.
    entity.save()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following model: class User: name = models.CharField( max_length = 200 )
Ok say I have the following model: class Country < ActiveRecord::Base validates_presence_of :name validates_presence_of
In my GWT app I have the following model class: import com.google.gwt.user.client.rpc.IsSerializable; public class
I have the following model class (simplified) class A{ private String name; private List<B>
I have following model: class UserProfile(models.Model): User profile model, cintains a Foreign Key, which
I am using Ruby on Rails v3.2.2. I have following model classes class Country
I have the following model: class A(models.Model): name = models.CharField(max_length=50) content_type = models.ForeignKey(ContentType) This
I have the following model in django: class Node(models.Model): name = models.CharField(max_length=255) And this
I have the following model: class Task(Model): solvers = ManyToManyField(User, related_name='slvrs') Now I want
I have the following model: class Model(...): date = DateField() user = ForeignKey() data

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.