'bool' object has no attribute 'get' ??

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

'bool' object has no attribute 'get' ??

nsteinmetz

Hello,

I have the following code but I do not understand why I have the error
below... could someone help me ?

class Comment(models.Model):
    author = models.CharField(maxlength=50)
    email = models.EmailField()
    title = models.CharField(maxlength=50)
    comment = models.TextField()
    post = models.ForeignKey(Post)
    parent = models.ForeignKey('self', blank=True, null=True,
related_name='child')
    submitted_at = models.DateTimeField(auto_now_add=True)
    pub_date = models.DateTimeField()
    pub_status = models.BooleanField()

    def __str__(self):
        return self.comment

    class Admin:
        list_display = ('author', 'title', 'pub_status')
        list_filter = ['pub_date']
        date_hierarchy = 'pub_date'
        search_fields = ['author', 'title', 'comment']

AttributeError at /admin/blog/comment/add/
'bool' object has no attribute 'get'
Request Method:         GET
Request URL:    http://localhost:8000/admin/blog/comment/add/
Exception Type:         AttributeError
Exception Value:        'bool' object has no attribute 'get'
Exception
Location:       /usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py
in get_manipulator_fields, line 116




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: 'bool' object has no attribute 'get' ??

nsteinmetz

Nicolas Steinmetz wrote:

> class Comment(models.Model):
>     author = models.CharField(maxlength=50)
>     email = models.EmailField()
>     title = models.CharField(maxlength=50)
>     comment = models.TextField()
>     post = models.ForeignKey(Post)
>     parent = models.ForeignKey('self', blank=True, null=True,
> related_name='child')

It looks django do not like multiple ForeignKey... I'll bypass it in a
different way ;)


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: 'bool' object has no attribute 'get' ??

nsteinmetz
In reply to this post by nsteinmetz

Anyone has an idea about this as I would like to set this key so that I can
have threaded comments.

Otherwise what would you suggest me to implement threaded comments ?

Nicolas

Nicolas Steinmetz wrote:

>
> Hello,
>
> I have the following code but I do not understand why I have the error
> below... could someone help me ?
>
> class Comment(models.Model):
>     author = models.CharField(maxlength=50)
>     email = models.EmailField()
>     title = models.CharField(maxlength=50)
>     comment = models.TextField()
>     post = models.ForeignKey(Post)
>     parent = models.ForeignKey('self', blank=True, null=True,
> related_name='child')
>     submitted_at = models.DateTimeField(auto_now_add=True)
>     pub_date = models.DateTimeField()
>     pub_status = models.BooleanField()
>
>     def __str__(self):
>         return self.comment
>
>     class Admin:
>         list_display = ('author', 'title', 'pub_status')
>         list_filter = ['pub_date']
>         date_hierarchy = 'pub_date'
>         search_fields = ['author', 'title', 'comment']
>
> AttributeError at /admin/blog/comment/add/
> 'bool' object has no attribute 'get'
> Request Method:         GET
> Request URL:    http://localhost:8000/admin/blog/comment/add/
> Exception Type:         AttributeError
> Exception Value:        'bool' object has no attribute 'get'
> Exception
> Location:      
> /usr/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/models/related.py
> in get_manipulator_fields, line 116
>
>
>
>
>


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: 'bool' object has no attribute 'get' ??

Russell Keith-Magee-2
In reply to this post by nsteinmetz

On 10/7/06, Nicolas Steinmetz <[hidden email]> wrote:

>
> Nicolas Steinmetz wrote:
>
> > class Comment(models.Model):
> >     author = models.CharField(maxlength=50)
> >     email = models.EmailField()
> >     title = models.CharField(maxlength=50)
> >     comment = models.TextField()
> >     post = models.ForeignKey(Post)
> >     parent = models.ForeignKey('self', blank=True, null=True,
> > related_name='child')
>
> It looks django do not like multiple ForeignKey... I'll bypass it in a
> different way ;)

Sorry for the long delay in responding to this message.

Django models can have multiple foreign keys; however, there are some
known issues with manipulators on models with self-referential foreign
keys that give the error message you are describing.

A good starting point is http://code.djangoproject.com/ticket/2536 -
this ticket has references to a few other tickets with similar
problems. Some of these tickets may give you some hints for
workarounds.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: 'bool' object has no attribute 'get' ??

nsteinmetz

Russell Keith-Magee a écrit :

> Sorry for the long delay in responding to this message.

no problem, it happens ;)

> Django models can have multiple foreign keys; however, there are some
> known issues with manipulators on models with self-referential foreign
> keys that give the error message you are describing.
>
> A good starting point is http://code.djangoproject.com/ticket/2536 -
> this ticket has references to a few other tickets with similar
> problems. Some of these tickets may give you some hints for
> workarounds.

Thanks for your support, I'll take a look at it during the week end :-)

Nicolas


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---