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

  • Home
  • SEARCH
  • 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 3595838
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T19:54:19+00:00 2026-05-18T19:54:19+00:00

I am using a form which is generated for me by django. I’m using

  • 0

I am using a form which is generated for me by django. I’m using this as a comment form after a post in my blog.

Currently it renders fine but it’s not nicely aligned.
This is what I have. alt text
This is what I’d like. alt text

Thanks

edit: This is the result when I user {{ form.as_table }}

alt text

  • 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-18T19:54:19+00:00Added an answer on May 18, 2026 at 7:54 pm

    Posting my solution hoping it’ll help someone else oneday.
    I knew that you’d style the fields with css but wasn’t sure how to assign the classes to each item. But if you take a look at the default template provided you’ll notice that the error class is assigned to a field using an if statement within a foreach loop that automatically generates each field within your form.
    i.e.

    {% for field in form %}    
    < p{% if field.errors %} 
        class="error"
    {% endif %}
        {{ field.label_tag }}<'/' p> 
    {% endfor %}
    

    So I added onto this functionality.

    < p{% if field.errors %} 
        class="error"
    {% endif %}
    {% ifequal field.name "honeypot" %} 
        id="hide"
    {% else %}
         id="left"
    {% endifequal %}>
        {{ field.label_tag }}<'/' p> 
    

    my css being

    #hide{
        display:none;
    
    }
    
    #left{
        width: 200px;
        text-align: left;
    
    }
    
    #right{
        width: 300px;
        text-align: left;
    
    }
    

    Now that you can set your classes you can easily setup your classes or id within your css file. This is for the comments.
    If you’re using a {{ form.as_p }} or {{ form.as_table }} to generate your form then you just set a general form class within your css to style it.
    i.e.

    form {
    width: 350px;
    padding: 20px;
    border: 1px solid #270644;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using a form which is generated for me by django. I'm using
I have a (django-generated) form with the following content: <form action=./ id=my_form method=post> ...
How do you detect which form input has focus using JavaScript or jQuery? From
How can I find out which FORM an HTML element is contained within, using
Using Zend_Form, how would I create form elements like this: <input type=text name=element[1] value=
if Form.Release is called after using the form, it will free all related memory
Background I'm using POST form submissions instead of links with concatenated arguments inside a
I'm using Django 1.0.2. I've written a ModelForm backed by a Model. This model
I have a Windows form that's generated using code (including buttons and what not).
I'm dynamically generating forms with hidden input in a webpage using django templates, which

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.