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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T20:48:13+00:00 2026-05-10T20:48:13+00:00

In my views.py, i have a snippit of code like this: def clean_post_data(form): for

  • 0

In my views.py, i have a snippit of code like this:

def clean_post_data(form):     for i in form.cleaned_data:         form.cleaned_data[i] = form.cleaned_data[i].rstrip()  def add_product(request):        form = ProductForm(request.POST, request.FILES or None)     image = Image.objects.all()     action = 'Add'      if request.POST:         if form.is_valid():             clean_post_data(form)             form.save()             action = 'Added new product'             return render_to_response('cms/admin/action.html', {'action' : action},context_instance=RequestContext(request))         else:             action = 'There was an error. Please go back and try again'             return render_to_response('cms/admin/action.html', {'action' : action}, context_instance=RequestContext(request))      return render_to_response('cms/admin/editproduct.html', {'form' : form, 'action' : action, 'image' : image}, context_instance=RequestContext(request)) 

But when i run that, i get the following error 'list' object has no attribute 'rstrip'. What am i doing wrong.

I originally had the for i in form.cleaned_data: loop directly in the view (not in another function) and it worked fine, but now when i try it i get the same error as above. http://dpaste.com/92836/

  • 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. 2026-05-10T20:48:13+00:00Added an answer on May 10, 2026 at 8:48 pm

    The clean_post_data shouldn’t be a stand-alone function.

    It should be a method in the form, named clean. See Form and Field Validation.

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

Sidebar

Related Questions

In my django views i have the following def create(request): query=header.objects.filter(id=a)[0] a=query.criteria_set.all() logging.debug(a.details) I
I have this code and i would like to use asyncTask manager with this
I have some code like this: <% cache footer_links do %> <%= cms_snippet_content('footer_links') %>
I have a dataset obtained from MySQL that goes like this: Array ( [0]
I have this code - (void)tabBar:(UITabBar *)tabBar didSelectItem:(UITabBarItem *)item What I am looking for
I have been fighting for like 6 hours with this now. I have followed
In the iPod app, the navigation views have the default status bar style, and
I'm developing a WPF app using MVVM. Most of my views have only xaml
I currently have a tableview, with cell views which have NSTextFields inside of them.
In the asp.net mvc 3 application I have two views which have the same

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.