On Jan 19, 11:03 am, Dan Jewett <[email protected]> wrote:
> Maybe I'm just implementing this incorrectly, but if anyone is using
> this extension maybe you could shed some light on this error.
>
> When I try to add or save my Model I get:
> AttributeError: 'str' object has no attribute 'creation_counter'
>
> Here's what I think is relevant.
> in models.py: (partial)
> from django_extensions.db.fields import AutoSlugField
>
> class Album(models.Model):
> title = models.CharField(max_length=250)
> slug = AutoSlugField(populate_from=title, max_length=250,
> editable=True)
> # slug = models.SlugField(max_length=250)
>
> in admin.py: (partial)
>
> class AlbumOptions(admin.ModelAdmin):
> prepopulated_fields = {'slug': ('title',)}
>
> On Album Add or Save, I get the error.
>
> <snip>
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> site-packages/django_extensions/db/fields/__init__.py" in pre_save
> 108. value = unicode(self.create_slug(model_instance, add))
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> site-packages/django_extensions/db/fields/__init__.py" in create_slug
> 63. populate_field = model_instance._meta.get_field
> (self._populate_from)
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> site-packages/django/db/models/options.py" in get_field
> 260. if f.name == name:
> File "/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/
> site-packages/django/db/models/fields/__init__.py" in __cmp__
> 102. return cmp(self.creation_counter,
> other.creation_counter)
>
> Exception Type: AttributeError at /admin/fc/album/1/
> Exception Value: 'str' object has no attribute 'creation_counter'
>
> Local vars:
> other 'id'
> self <django.db.models.fields.CharField object at 0x1182850>
>
> Thanks for any suggestions.
> Dan J.
Found it. populate_from wants a string.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---