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
--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment