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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:06:54+00:00 2026-06-18T15:06:54+00:00

I am using Django form for inputs. However, I would like to custom it

  • 0

I am using Django form for inputs. However, I would like to custom it a little bit. For example the following Django code will be translated into:

#Django code

aerial_size_dist = forms.ChoiceField(initial='Very Fine to Fine') 

#Translated HTML  
<tr><th><label for="id_aerial_size_dist">Aerial size dist:</label></th><td><select name="aerial_size_dist" id="id_aerial_size_dist"></select></td></tr>

My question is that how to add a label property such as "style" from working from the Django side? Can widget change Django form label property?

Target HTML

<tr><th><label for="id_aerial_size_dist" style="display:none;">Aerial size dist:</label></th><td><select name="aerial_size_dist" id="id_aerial_size_dist"></select></td></tr>
  • 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-18T15:06:56+00:00Added an answer on June 18, 2026 at 3:06 pm

    Similar problem is answered here:
    Get the ID of a field widget in a formset .
    Although it doesn’t allow you to customize the ID directly, it uses default (autogenerated) ID

    (Short answer) use this in template:

    EDIT:

    <label for="{{ form.my_field.id_for_label }}">{{ form.my_field.label }}</label>
    

    old one: (this was not working in some cases – see comments)

    <label for="{{ form.my_field.auto_id }}">{{ form.my_field.label }}</label>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django form using textareas and TinyMCE for text entry. I would
I started using the Django today, and tried building a html form the code
When rendering a django form using the as_p method, you traditionally get something like:
I would like to be able to extract different information in my django form:
I'm using Django-Registration and the form just has 3 fields (Username, Email, Password, and
I'm using django, and have a static webpage with a GET form, and about
I'm willing to build a restful service using Django, I'm coming form RoR background
I've run into a problem with using two models for my form in Django.
I'm new to Django and just trying to submit a form using ModelForms to
I want to ignore the post form in the django's internatonalization. I am using

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.