» many-to-many in list display django
many-to-many in list display django
|August 7, 2013
Posted by forumadmin
product = models.ManyToManyField('Product')
vendor = models.ForeignKey('VendorProfile')
dollar_amount = models.FloatField(verbose_name='Price')
products = models.CharField(max_length=256)
I have that code. Unfortunately, the error comes in admin.py with the “ManyToManyField”
fields = ['product', 'dollar_amount']
list_display = ('product', 'vendor')
The error says “‘PurchaseOrderAdmin.list_display‘, ‘product’ is a ManyToManyField which is not supported.”
However, it compiles when I take ‘product’ out of list_display. So how can I display ‘product’ in list_display without giving it errors?
edit: Maybe a better question would be how do you display a ManyToManyField in list_display?
More Related Questions
- Django Admin: OneToOne Relation as an Inline? I am putting together the admin for a satchmo application. Satchmo uses OneToOne relations to extend the base Product model, and I'd like to edit it all on one page.
It is possible to […]
- Default value for field in Django model Suppose I have a model:
id = models.AutoField(primary_key=True)
a = models.CharField(max_length=10)
b = […]
- Django auto_now and auto_now_add For Django 1.1.
I have this in my models.py:
created = models.DateTimeField(auto_now_add=True)
modified = models.DateTimeField(auto_now=True)
- Dynamic rendering of template I have a model class Product in which I am storing generic things related to a product like name, owner, price, image and type. Here the type attribute represents the category of the […]
- get the version of django for application I am starting a new( actually very old) project which I know is in django. I am getting lost knowing the exact version of django it has been build upon. Is there any way I can know the […]
- Django. You dont have permission to edit anything I created a little app a while ago. I created admin.py and used admin.site.register(MenuEntry) to add the class to admin console. It showed the items of that class just fine.
Then I began […]
- filter admin show in django by users I add one ManyToManyField to my Users profile:
user = models.OneToOneField(User)
news_letters = models.ManyToManyField(news_letter)
and replace it […]
- django admin – change search_fields results ordering Is there any way to change the ordering of search results when using search_fields in your admin.py?
Here is what I have so far:
- Django Admin – change header Django administration text How does one change the 'Django administration' text in the django admin header?
It doesn't seem to be covered in the "Customizing the admin" documentation. Asked By - […]
- Django Admin – Disable the Add action for a specific model I have a django site with lots of models and forms. I have many custom forms and formsets and inlineformsets and custom validation and custom querysets. Hence the add model action depends […]