Hi,
I'm getting the error 'str' object has no attribute 'creation_counter'
in Django admin when adding an Inlines option to an admin.ModelAdmin
class... and I don't understand why.
Traceback:
File "C:\python25\lib\site-packages\django\core\handlers\base.py" in
get_response
86. response = callback(request, *callback_args,
**callback_kwargs)
File "C:\python25\lib\site-packages\django\contrib\admin\sites.py" in
root
157. return self.model_page(request, *url.split('/',
2))
File "C:\python25\lib\site-packages\django\views\decorators\cache.py"
in _wrapped_view_func
44. response = view_func(request, *args, **kwargs)
File "C:\python25\lib\site-packages\django\contrib\admin\sites.py" in
model_page
176. return admin_obj(request, rest_of_url)
File "C:\python25\lib\site-packages\django\contrib\admin\options.py"
in __call__
199. return self.change_view(request, [unquote(part) for
part in url.split(PRIMARY_KEY_URL_SEPARATOR)])
File "C:\python25\lib\site-packages\django\db\transaction.py" in
_commit_on_success
238. res = func(*args, **kw)
File "C:\python25\lib\site-packages\django\contrib\admin\options.py"
in change_view
597. formset = FormSet(instance=obj)
File "C:\python25\lib\site-packages\django\forms\models.py" in
__init__
468. queryset=qs)
File "C:\python25\lib\site-packages\django\forms\models.py" in
__init__
352. super(BaseModelFormSet, self).__init__(**defaults)
File "C:\python25\lib\site-packages\django\forms\formsets.py" in
__init__
67. self._construct_forms()
File "C:\python25\lib\site-packages\django\forms\models.py" in
_construct_forms
474. super(BaseInlineFormSet, self)._construct_forms()
File "C:\python25\lib\site-packages\django\forms\formsets.py" in
_construct_forms
76. self.forms.append(self._construct_form(i))
File "C:\python25\lib\site-packages\django\forms\models.py" in
_construct_form
477. form = super(BaseInlineFormSet, self)._construct_form
(i, **kwargs)
File "C:\python25\lib\site-packages\django\forms\models.py" in
_construct_form
357. return super(BaseModelFormSet, self)._construct_form(i,
**kwargs)
File "C:\python25\lib\site-packages\django\forms\formsets.py" in
_construct_form
96. self.add_fields(form, i)
File "C:\python25\lib\site-packages\django\forms\models.py" in
add_fields
491. if self._pk_field == self.fk:
File "C:\python25\lib\site-packages\django\db\models\options.py" in
__eq__
28. return field_name in self.names
File "C:\python25\lib\site-packages\django\db\models\fields
\__init__.py" in __cmp__
102. return cmp(self.creation_counter,
other.creation_counter)
Exception Type: AttributeError at /admin/binatang/plantfamily/1/
Exception Value: 'str' object has no attribute 'creation_counter'
Parent and child models:
class plantFamily(models.Model):
familyID = models.AutoField(primary_key=True)
family = models.CharField(max_length=50,null=True)
class plantGenus(models.Model):
genusID = models.AutoField(primary_key=True)
familyID = models.ForeignKey(plantFamily,
verbose_name='family',null=True,blank=True)
genus = models.CharField(max_length=50,null=True)
...and admin entries:
class plGenIn(admin.TabularInline):
model = plantGenus
class plFamAdmin(admin.ModelAdmin):
inlines = [plGenIn,]
I'm sure I had this working before, but since then I have installed
the composite primary key patch and I notice the 2nd to last traceback
is in class CompositePrimaryKey... Could this be something to do with
it?? All ideas appreciated
Thanks
Phil B
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---