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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T01:28:20+00:00 2026-06-15T01:28:20+00:00

I’m having a small (but annoying) problem with django forms right now. I’m using:

  • 0

I’m having a small (but annoying) problem with django forms right now.

I’m using:

  • twitter bootstrap
  • django floppyforms (just for the html5 widgets)
  • django crispy-forms (for the template tags & rendering)
  • my forms are all ModelForms and that shouldn’t change if possible

I’ve searched the whole web and tried a lot of stuff, but I can’t figure out the place where I can inject help_text=”Some random help text” into the code. So here’s my code(abbreviated for sanity reasons):

#forms.py:

import floppyforms as forms
from crispy_forms.helper import FormHelper
from crispy_forms.layout import *
from crispy_forms.bootstrap import *
from courses.models import *

class CourseForm(forms.ModelForm):
    class Meta:
    model = Course
    widgets = {
        'title': forms.TextInput,  # This is a floppyforms widget
        ...
    }

    def __init__(self, *args, **kwargs):
        self.helper = FormHelper()
        self.helper.form_method = 'POST'
        self.helper.form_id = ''
        self.helper.form_class = 'form-horizontal'
        self.helper.form_action = ''  # redirect in the view
        self.helper.form_tag = True
        self.helper.help_text_inline = True  # means that I want <span> elements 
        self.helper.layout = Layout(
            Fieldset('Create a new course',  # fieldset label
                Field('title', placeholder="Something...", css_class="span4"),
                ...
            ),
            FormActions(
                Submit(
                    'submit',
                    'Submit',
                    css_class="btn-primary"
                )
            ),
        )
        super(CourseForm, self).__init__(*args, **kwargs)

I tried to inject it as an ‘attrs’ dict into the widget and as an attr into the Field.

forms.TextInput(attrs={'help_text': 'Some help text'})
Field('title', help_text="Some help text", css_class="span4")

Needless to say that it didn’t work. I need a hook to put the help text into a ‘span’ or ‘p’ inside my controls-div, not into the input widget.

My template is very minimal and it should stay that way if possible. I don’t want to iterate over the form fields:

#create_course.html

{% extends 'base.html'%}
{% load crispy_forms_tags %}

{% block content%}
{% crispy form %}
{% endblock content%} 

That renders as the following html:

<div id="div_id_title" class="clearfix control-group">
  <label class="control-label requiredField" for="id_title">
    Title
    <span class="asteriskField">*</span>
  </label>
  <div class="controls">
    <input id="id_title" class="span4 textinput textInput" type="text" placeholder="Something..." maxlength="60" required="" name="title">
  </div>
</div>

With the help text it should look like this:

<div id="div_id_title" class="clearfix control-group">
  <label class="control-label requiredField" for="id_title">
    Title
    <span class="asteriskField">*</span>
  </label>
  <div class="controls">
    <input id="id_title" class="span4 textinput textInput" type="text" placeholder="Something..." maxlength="60" required="" name="title">
    **<span class="help-inline">Supporting help text</span>**
  </div>
</div>

Any help is appreciated! I haven’t tried to inject the code through views.py into the form, but I see no point in doing that. It should be possible to do that in forms.py with the right hook and syntax.

Sorry for the long text for such a simple problem 😉

  • 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-15T01:28:21+00:00Added an answer on June 15, 2026 at 1:28 am

    I found out what the problem was. Since I didn’t really define the Fields anywhere (I only defined the field widgets), I couldn’t access the help_text. You can either define the Fields in forms.py (which is unnecessary and bad practice, they’re ModelFields after all) or set the help_text for the model in models.py.

    Hope that helps others who have a similar problem.

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

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
this is what i have right now Drawing an RSS feed into the php,
We're building an app, our first using Rails 3, and we're having to build
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I am reading a book about Javascript and jQuery and using one of the
I used javascript for loading a picture on my website depending on which small
Seemingly simple, but I cannot find anything relevant on the web. What is the

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.