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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T20:26:54+00:00 2026-06-04T20:26:54+00:00

I am new to Django. Now I have class defined below PROPERTY_TYPE_CHOICE = [[‘1’,

  • 0

I am new to Django.
Now I have class defined below

PROPERTY_TYPE_CHOICE = [['1', 'Fixed (TODO)'],
                    ['2', 'Trajectory (TODO)'],
                    ['3', 'Error_Detecting'],
                    ['4', 'Error_Correcting']]
FIXED_TYPE_CHOICE = [['1', 'Prefix',
                      '2', 'Suffix']]

class UploadFileForm(forms.Form):
    # title = forms.CharField(max_length=50)
    automata_file  = forms.FileField(required = True)
    transducer_file = forms.FileField(required = True)
    property_type = forms.ChoiceField(choices=PROPERTY_TYPE_CHOICE,
                                      required=True)
    fixed_type = forms.ChoiceField(choices=FIXED_TYPE_CHOICE,
                                   required=True)
    debug_output = forms.BooleanField(required=False)

I have this PROPERTY_TYPE_CHOICE showed in the front html

<div class="fieldWrapper">
    {{ form.property_type.errors }}
    <label for="id_a">Select <u>a type</u> of property:</label>
    {{ form.property_type }}
</div>

and I want to show the FIXED_TYPE_CHOICE if I choose the first choice “Fixed (TODO)” in the PROPERTY_TYPE_CHOICE.
I read the docs about Django, and I think it may be implemented in this way:

<div class="fieldWrapper">
    {{ form.property_type.errors }}
    <label for="id_a">Select <u>a type</u> of property:</label>
    {{ form.property_type }}
</div>
{% if form.property_type=='1' %}
    <div class="fieldWrapper">
        {{ form.fixed_type.errors }}
        <label for="id_a">Select <u>a fixed type</u> of property:</label>
    {   { form.fixed_type }}
    </div>
{% endif %}

But I can’t do that.
What should I do? Thank you.

  • 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-04T20:26:56+00:00Added an answer on June 4, 2026 at 8:26 pm

    form.property_type is a BoundForm object, if you want to access its value you’ll need to use form.property_type.value

    Which is why your comparison of {% if form.property_type=='1'} doesn’t work.

    For more details see this page about 2/3rds of the way down, under the Customizing the Form Template section.

    For updating without a page refresh, you’ll need Javascript like the following (make sure you also include the jQuery library (http://jquery.com/):

    $("#property_type").change (function() {
        if($(this).val() == '1') {
            $("#fixed_type").show();
        } else {
            $("#fixed_type").hide();
        }
    } )
    

    And make sure that the give the dropdowns corresponding id attributes (id="property_type") for example.

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

Sidebar

Related Questions

I'm new to Django. I have created a new App called Directorio and now
I am new to Django. I have a model and now I need to
I create a new Django app (not project) called Bussinesses, then add following class
I'm new to Django, but the application that I have in mind might end
I'm rather new to Django and I'm using Django 1.0. I have this: forms.py:
I'm new to Django but I seem to have nearly identical code working on
I'm new to Django, trying to process some forms. I have this form for
If I have the following model in django; class MyModel(models.Model): name = models.CharField(max_length=50) fullname
I have a Django 'add business' view which adds a new business with an
I have the below db model: from datetime import datetime class TermPayment(models.Model): # I

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.