Answer the question
In order to leave comments, you need to log in
How to change the title of the TabularInline field?
Hello everyone, there is a problem, I did TabularInline on the ManyToMany field in the admin panel. Everything works fine, but there is one problem with one header, I can’t change this header in any way (see picture). How can I do that?
Models
class Users(AbstractBaseUser):
....
pages = models.ManyToManyField(Pages,related_name="permissions",verbose_name='Страницы')
class Pages(models.Model):
...
def __unicode__(self):
return self.title
class Meta:
verbose_name = 'Страницы'
verbose_name_plural = 'Страницы'
class PermissionsAdmin(admin.TabularInline):
model = Users.pages.through
model.__unicode__ = lambda x: u'Страницы'
model._meta.verbose_name = 'доступ'
model._meta.verbose_name_plural ='доступ'
extra = 1
Answer the question
In order to leave comments, you need to log in
In general, I figured it out myself, this is done in the following way
class PermissionsAdmin(admin.TabularInline):
model = Users.pages.through
model.__unicode__ = lambda x: u'Выбирите страницу'
model._meta.verbose_name = 'объект'
model._meta.verbose_name_plural ='права доступа'
model._meta.local_fields[2].verbose_name = 'Страница'
Try like this.
class PermissionsAdmin(admin.TabularInline):
model = Users.pages.through
verbose_name_plural = 'Права доступа'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question