On Sun, 2008-02-10 at 09:27 -0500, Prof. William Battersea wrote:
> Hello,
> 
> I created a Django application, validated it for errors and ran syncdb
> without any problems. I can click into the admin section but as soon
> as I click "Add" for one of my models I get the error
> AttributeError at /admin/gallery/gallery/add/
> 'str' object has no attribute 'creation_counter'
> Request Method:       GET
> Request URL:  http://localhost/admin/gallery/gallery/add/
> Exception Type:       AttributeError
> Exception Value:      'str' object has no attribute 'creation_counter'
> Exception Location:
>       C:\Python25\lib\site-packages\django\db\models\fields\__init__.py in
> __cmp__, line 100
> 
> This line is:
>   def __cmp__(self, other):
>        # This is needed because bisect does not take a comparison function.
>        return cmp(self.creation_counter, other.creation_counter)
> 
> I'm having a hard time troubleshooting this. My models look fine to me.

So you're quite familiar with your models and cannot see the problem. We
are not familiar with them, but only get shown the last line of the
traceback. It seems like one party has a lot more information than the
other here. :-)

If your model is short (and preferably, try to reduce your example to a
very short case that still fails), post the model.

Also, look at the full traceback in the debug screen, go to the last
line and click on the local variables button. You'll be able to see what
"self" and "other" are. One of them *won't* be a Field class, although
it should be (since creation_counter is an attribute on the Field
class). That might give you some clues as to what is going wrong.
Somehow you are managing to get a string into somewhere that a Field
class (or subclass) is expected.

Do you have a custom save() method involved here at all? It's going to
be something like that, since it's not the field definitions themselves
(the model validated).

Sorry I can't offer an immediate solution, but the lack of information
is hurting us a bit here.

Regards,
Malcolm

-- 
Save the whales. Collect the whole set. 
http://www.pointy-stick.com/blog/


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

Reply via email to