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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:30:40+00:00 2026-05-16T06:30:40+00:00

Why do I get the following error in my app Caught TypeError while rendering:

  • 0

Why do I get the following error in my app

Caught TypeError while rendering: 'ModelNameHere' object is not iterable

but I don’t get it when I execute it from the shell?

I just have a custom field in my form which inherits from forms.ModelForm

custom_serving_size = forms.ChoiceField(
    ServingSize.objects.all(),
    widget=forms.Select(attrs={'class':'ddl'})
)

EDIT

This is my form class

class RecipeIngredientForm(forms.ModelForm):
    serving_size = forms.ChoiceField(choices=ServingSize.objects.all())

The error happens on ServingSize.objects.all()

  • 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-16T06:30:40+00:00Added an answer on May 16, 2026 at 6:30 am
    custom_serving_size = forms.ChoiceField(
        ServingSize.objects.all(),
        widget=forms.Select(attrs={'class':'ddl'})
    )
    

    this has to be

    custom_serving_size = forms.ModelChoiceField(
        queryset=ServingSize.objects.all(),
        widget=forms.Select(attrs={'class':'ddl'})
    )
    

    or

    custom_serving_size = forms.ChoiceField(
        choices=[(obj.id, `text user sees`) for obj in ServingSize.objects.all()],
        widget=forms.Select(attrs={'class':'ddl'})
    )
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I get the following error when compiling my app. warning: class 'ConfigureViewController' does not
I'm building a file management app, and I occasionally get the following error while
I get the following error messages when I run the app: Description Resource Path
When I push a default express app to heroku I get the following error.
Upon launching a sinatra app, I get the following error message: /home/matt/.rvm/gems/ruby-1.9.3-p125/gems/backports-2.5.1/lib/backports/tools.rb:310:in `require': cannot
Sometimes when I am inside my app, I get the following error : java.io.IOException:
When running the packaged app like java -jar my-app-0.0.1-SNAPSHOT-jar-with-dependencies.jar, I get the following error:
Trying to get MGTwitterEngine app to build. Getting one pesky error. The following ERROR.
I get the following error: Vpim::InvalidEncodingError (email@email.net): 2011-06-07T01:37:06+00:00 app[web.1]: .bundle/gems/ruby/1.8/gems/vpim-0.695/lib/vpim/field.rb:110:in `decode0' It has worked
I get the following error: [app (master)]$ heroku rake db:migrate rake aborted! undefined method

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.