Hi,

Since I can't (as far as I can tell) enable inline editing on a one-to-
one field, I'm trying to use an inline-edited many-to-many field with
a related object maximum of 1. Trivial example:

class Trivial(models.Model):
    name = models.CharField(maxlength=50)

    class Admin:
        pass

class Child(models.Model):
    name = models.CharField(maxlength=50, core=True)
    trivial = models.ForeignKey(Trivial, edit_inline=models.STACKED,
max_num_in_admin=1)

    class Admin:
        pass


This produces the following error message when I try to add a new
Trivial object in the admin interface:

Traceback (most recent call last):
File "C:\Python25\lib\site-packages\django\template\__init__.py" in
render_node
  723. result = node.render(context)
File "C:\Python25\Lib\site-packages\django\template\defaulttags.py" in
render
  122. nodelist.append(node.render(context))
File "C:\Python25\lib\site-packages\django\contrib\admin\templatetags
\admin_modify.py" in render
  170. bound_related_object = relation.bind(context['form'], original,
bound_related_object_class)
File "C:\Python25\lib\site-packages\django\db\models\related.py" in
bind
  129. return bound_related_object_class(self, field_mapping,
original)
File "C:\Python25\lib\site-packages\django\contrib\admin\templatetags
\admin_modify.py" in __init__
  148. self.field_mappings.fill()
File "C:\Python25\lib\site-packages\django\oldforms\__init__.py" in
fill
  275. field = self.parent_manipulator[full_field_name]
File "C:\Python25\lib\site-packages\django\oldforms\__init__.py" in
__getitem__
  27. raise KeyError, "Field %s not found\n%s" % (field_name,
repr(self.fields))

  KeyError at /admin/apptest/trivial/add/
  'Field child.1.id not found\n[FormField "name", FormField "child.
0.id", FormField "child.0.name"]'


As far as I can tell, Django is reaching for child.1.id for some
reason, when it shouldn't go beyond child.0.id. Is there a way to fix
this? Am I thinking about the underlying problem wrong to begin with?

Thanks,
charles


--~--~---------~--~----~------------~-------~--~----~
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