#8903: admin.TabularInline creates duplicate pk input boxes
-------------------------------------------+--------------------------------
Reporter: Spads | Owner: nobody
Status: new | Milestone:
Component: django.contrib.admin | Version: 1.0
Resolution: | Keywords: admin TabularInline
Stage: Unreviewed | Has_patch: 0
Needs_docs: 0 | Needs_tests: 0
Needs_better_patch: 0 |
-------------------------------------------+--------------------------------
Comment (by kratorius):
Since dpaste is going to delete the code in the near future, here's the
test case:
{{{
#!python
class NetworkInterface(models.Model):
location = models.ForeignKey(Equipment, verbose_name="system")
ip = models.IPAddressField("IP address", primary_key=True,
default='127.0.0.1')
mac = models.CharField("MAC address", max_length=17, unique=True,
default='02:00:00:00:00:01')
interface_name = models.CharField(max_length=15, default="eth0")
media_settings = models.CharField(max_length=10, blank=True,
default='HURG')
def __unicode__(self):
return unicode(u'%s %s: %s', location, self.interface_name,
self.ip)
}}}
{{{
#!python
class NetworkInterface_Inline(admin.TabularInline):
model = models.NetworkInterface
fk_name = 'location'
class EquipmentOptions(admin.ModelAdmin):
inlines = [NetworkInterface_Inline, PowerSupply_Inline, Memory_Inline,
Processor_Inline]
admin.site.register(models.Equipment, EquipmentOptions)
}}}
Producing:
{{{
<tr class="row1 ">
<td class="original">
<input type="text" name="networkinterface_set-0-ip" value="127.0.0.1"
id="id_networkinterface_set-0-ip" />
</td>
<td class="ip">
<input type="text" name="networkinterface_set-0-ip"
value="127.0.0.1" id="id_networkinterface_set-0-ip" />
</td>
<td class="mac">
<input name="networkinterface_set-0-mac" value="02:00:00:00:00:01"
class="vTextField" maxlength="17"
type="text" id="id_networkinterface_set-0-mac" />
</td>
<td class="interface_name">
<input name="networkinterface_set-0-interface_name" value="eth0"
class="vTextField" maxlength="15"
type="text" id="id_networkinterface_set-0-interface_name" />
</td>
<td class="media_settings">
<input name="networkinterface_set-0-media_settings" value="HURG"
class="vTextField" maxlength="10"
type="text" id="id_networkinterface_set-0-media_settings" />
</td>
<td class="delete"></td>
</tr>
}}}
--
Ticket URL: <http://code.djangoproject.com/ticket/8903#comment:4>
Django <http://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django updates" 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-updates?hl=en
-~----------~----~----~----~------~----~------~--~---