Opened 10 years ago
Closed 10 years ago
#24976 closed Bug (fixed)
admin.TabularInline custom form field header displaying as None on admin page
| Reported by: | Kartik Anand | Owned by: | matiasb |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.8 |
| Severity: | Normal | Keywords: | TabularInline |
| Cc: | Triage Stage: | Accepted | |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
While using admin.TabularInline with a custom form, for any form field if one doesn't specify a label, then it would come up as "None" on admin page, but one doesn't need to specify it for admin.StackedInline.
Attached Image
To reproduce:
models.py
from django.db import models
class Foo(models.Model):
title = models.CharField(max_length=128)
class Meta:
verbose_name = "Foo"
verbose_name_plural = "Foo"
def __str__(self):
pass
class Bar(models.Model):
title = models.CharField(max_length=128)
foo = models.ForeignKey(Foo)
class Meta:
verbose_name = "Bar"
verbose_name_plural = "Bars"
def __str__(self):
return self.title
admin.py
from django.contrib import admin
from django import forms
from . import models
class BarInlineForm(forms.ModelForm):
title = forms.CharField(max_length=128)
class Meta:
model = models.Bar
fields = ('title',)
class BarInline(admin.TabularInline):
model = models.Bar
form = BarInlineForm
extra = 3
class FooAdmin(admin.ModelAdmin):
inlines = [BarInline]
admin.site.register(models.Foo, FooAdmin)
Attachments (1)
Change History (5)
by , 10 years ago
| Attachment: | Screenshot from 2015-06-12 19:29:22.png added |
|---|
comment:1 by , 10 years ago
| Easy pickings: | unset |
|---|---|
| Triage Stage: | Unreviewed → Accepted |
comment:2 by , 10 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → assigned |
comment:3 by , 10 years ago
| Has patch: | set |
|---|
Pull request created: https://github.com/django/django/pull/5403
All tests passing for SQLite.
Note:
See TracTickets
for help on using tickets.
Screenshot of admin page