How to change in_stock verbose_name ?
Models.py
class Book(models.Model): name = models.CharField(u"Нэр", max_length = 200) @property def in_stock(self): return self.stocks.count()
Im Admin.py
class BookAdmin(admin.ModelAdmin): list_display = ('name', 'in_stock') search_fields = ('name', )
One of the most powerful parts of Django is the automatic admin interface. It reads metadata from your models to provide a quick, model-centric interface where trusted users can manage content on your site. The admin's recommended use is limited to an organization's internal management tool.
editable=False will make the field disappear from all forms including admin and ModelForm i.e., it can not be edited using any form. The field will not be displayed in the admin or any other ModelForm.
Take a look at the Model Meta in the django documentation. Within a Model you can add class Meta this allows additional options for your model which handles things like singular and plural naming. Show activity on this post. inside model.py or inside your customized model file add class meta within a Model Class.
I guess you should use short_description attribute. Django-admin
def in_stock(self): return self.stocks.count() in_stock.short_description = 'Your label here'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With