Opened 16 years ago

Closed 16 years ago

#9650 closed (duplicate)

Initial value for CharField primary key is not hidden in admin's inline form

Reported by: Joey Wilhelm Owned by: nobody
Component: contrib.admin Version: 1.0
Severity: Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Given the following:

from django.db import models
from django.contrib import admin

class Client(models.Model):
    client_name = models.CharField(max_length=255)

class ClientDomain(models.Model):
    domain_name = models.CharField(max_length=255, primary_key=True)
    client = models.ForeignKey(Client)

class DomainInline(admin.TabularInline):
    model = ClientDomain
    extra = 1

class ClientAdmin(admin.ModelAdmin):
    inlines = (DomainInline,)

admin.site.register(Client, ClientAdmin)

The following HTML is generated in the "extra" inline:

<td class="original">
  <input id="id_domains-0-domain_name" type="text" class="vTextField" name="domains-0-domain_name" maxlength="255" />
  <input type="hidden" name="domains-0-client" value="1" id="id_domains-0-client" />
</td>
<td class="domain_name">
  <input id="id_domains-0-domain_name" type="text" class="vTextField" name="domains-0-domain_name" maxlength="255" />
</td>

And for existing record inlines:

<td class="original">
  <p>localhost</p>
  <input name="domains-0-domain_name" value="localhost" class="vTextField" maxlength="255" type="text" id="id_domains-0-domain_name" />
  <input type="hidden" name="domains-0-client" value="1" id="id_domains-0-client" />
</td>
<td class="domain_name">
  <input name="domains-0-domain_name" value="localhost" class="vTextField" maxlength="255" type="text" id="id_domains-0-domain_name" />
</td>

I am using the 1.0.X SVN branch.

Change History (1)

comment:1 by anonymous, 16 years ago

Resolution: duplicate
Status: newclosed

Duplicate of #8903

Note: See TracTickets for help on using tickets.
Back to Top