Larry Martell
unread,Nov 29, 2012, 9:10:49 AM11/29/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to django...@googlegroups.com
This is probably very simple, but I've never run into this before and
googling has not revealed anything.
I have these 2 models:
class Category(models.Model):
class Meta: db_table = 'data_category'
name = models.CharField(max_length=20, unique=True, db_index=True)
class Tool(models.Model):
class Meta: db_table = 'data_tool'
name = models.CharField(max_length=10, unique=True)
category = models.ForeignKey(Category)
In admin when I click on 'Categorys' I get a table of 'Category
object' and I have to click on those to get at an actual row in the
table. How can I make the data available from 'Categorys' without that
extra level?
Similarly, in Tools the Category column has 'Category object' and when
I click on a specific tool and get into change tool, the Category is a
drop down that has 'Category object' as every choice. How can I make
the actual category names appear here?
I tried defining a CategoryAdmin class:
class CategoryAdmin(admin.ModelAdmin):
list_display = ('name')
list_filter = ('name')
admin.site.register(Category, CategoryAdmin)
But that fails with 'CategoryAdmin.list_display' must be a list or tuple.
And finally, how can I get it to display 'Categories' instead of 'Categorys'
TIA!
-larry