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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T11:56:19+00:00 2026-05-13T11:56:19+00:00

New to python and django. Using the forms module and going through the errors

  • 0

New to python and django. Using the forms module and going through the errors one by one (so not just dumping them at the top)

I noticed this solution to be able to set a custom format for errors, in my case, it’d be:

<dd class="error">errstr</dd>

And more or less copying the example provided, I have the following:

forms.py ( I expanded it slightly just for my sake)

class DefinitionErrorList(forms.util.ErrorList):

    def __unicode__(self):    
        return self.view_as_dd()

    def view_as_dd(self):
        if not self: 
            return u'' 

        return u'<dd class="error">%s</dd>' % '<br />'.join([u'<span>%s</span>' % e for e in self])

main.py

from poke.forms import PokeForm, DefinitionErrorList

def create_new(response, useless):

    if response.method == 'POST':
        # They posted something, so collect it (duh)

        f = PokeForm(response.POST, error_class=DefinitionErrorList)

        if f.is_valid():
            cd = f.cleaned_data

template for reference

<dt>A small message to remind yourself</dt>
{{ form.message.errors }}
<dd>
    <span class="input_border" style="width: 75%;"> {{ form.message }}</span> 
    <span class="tooltip_span">{{ tooltip.message }}</span>
</dd>

The problem is is that with the above, if a field has an error, it still uses the default format (the ), and no matter what I try I can’t get my one to be used. I’m pretty sure I missed something small or misunderstood some instructions.

Thanks for any help and I’m sorry if I forgot any information!

Edit: I’m using Django 1.1, if that helps any. And to make it (possibly) clearer, the errors are displaying fine, they just aren’t looking the way I want them to.

  • 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-13T11:56:20+00:00Added an answer on May 13, 2026 at 11:56 am

    there has been a long lasting ticket on this. http://code.djangoproject.com/ticket/6138

    latest update says it’s fixed. see if it works in trunk. if not, submit your bug. if it does, get the patch or wait til the next release. (although i thought the latest release was after the date of the last update on the ticket).

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

Sidebar

Related Questions

I'm fairly new to both Django and Python. This is my first time using
We are working on a new web site using Apache, Python and Django. In
I have made an online gallery using Python and Django. I've just started to
I am new to python and I am using django for student database application
I am new to python for web apps, and am using django for my
I'm new to Django and python. I've done login forms but I need to
I'm new to Python and Django. I'm configuring a Django project using a PostgreSQL
I'm new to Django and to Python, and I've just completed Django's build your
I'm really new to Python and Django. I created a class in Python that
I'm new with Django and python. I have a problem. Is there a way,

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.