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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:19:14+00:00 2026-05-22T03:19:14+00:00

Every thing is working great until i try to add a form with ModelForm.

  • 0

Every thing is working great until i try to add a form with ModelForm. that throw the exception:

‘str’ object has no attribute ‘_default_manager’

My models and the ModelForm:

class Story(models.Model):
    title = models.CharField('סיפור', max_length=100, unique=True)
    body = models.TextField('תוכן') #RichTextField('תוכן')
    posted = models.DateField('תאריך פרסום', db_index=True)
    category = models.ForeignKey('Category', verbose_name='קטגוריה')
    created_by = models.ForeignKey(User, verbose_name='נכתב ע"י')

class Meta:
    verbose_name = 'סיפור'
    verbose_name_plural = 'סיפורים'

def __unicode__(self):
    return self.title


class StoryForm(ModelForm):    
    class Meta:
        model = Story 

class Category(models.Model):
title = models.CharField('קטגוריה', max_length=100, db_index=True)

class Meta:
    verbose_name = 'קטגוריה'
    verbose_name_plural = 'קטגוריות'

def __unicode__(self):
    return self.title

with the admin manager:

admin.site.register(Story)
admin.site.register(Category)

I had more stuff over there but i marked everything out and left only this lines to check, but still crashing…

I read that in previous django trunks it was a problem with the admin because of the admin manager, but i read that it was solved. I can’t find the solution for why does this happen only when i try to add a ModelForm class.

Just don’t understand, if it is because of the model or the admin, why didn’t it happen until i am trying to add a form? if it is not, why a ModelForm can cause such a problem?

Just to be clear as possible, i marked every think out, all i have is the ModelForm definition, i am not calling it or anything…. it is in the creation of it that the exception happens.

Can any one please help me with this….I can’t build a site without forms…. 🙂

Thank you,
Erez

  • 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-22T03:19:15+00:00Added an answer on May 22, 2026 at 3:19 am

    I’ve solved the problem….

    Apparently, the problem what because the modelform was rendered before the category class so it didn’t recognize it and tried to add it as a string….

    moving the ModelForm class to forms.py solved the problem….

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

Sidebar

Related Questions

Until lately, my application was working great with Facebook connect. When you click on
My application has a custom window design, which means that every window has the
I'm working on a solution that has a couple DLLS meant for the GAC.
I'm using the django-contrib package django-profiles , and everything is working great - my
Hi im making a custom Textbox i got everty thing working but how do
Background Lately I've become a fanatic that everything I type while working on a
The first thing I do in a public method is to validate every single
When I see Lua, the only thing I ever read is great for embedding,
I've been following alone with this tutorial . Everything is going great, until I
Everything was working great with the build. Then this started popping up after 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.