Maybe you're referring to verbose_name_plural?
In that case, the “DATASET” would be the verbose_name of that field,
and “Dataset_users object” is the string representation of the
original original object that the row corresponds to.
On Thu, Jul 7, 2016 at 5:24 PM, Michal Petrucha <michal....@koniiiik.org> wrote:In that case, the “DATASET” would be the verbose_name of that field,
and “Dataset_users object” is the string representation of the
original original object that the row corresponds to.
Unfortunately no.. :(
I have set all verbose_name and verbose_name_plural, on all models.. and all models have str representation.. but still show these dataset_users object... instead the verbose_nameThese "problem" occur only when I have M2M field.. in other FK fields doesn't appears..
Can you post a simplified excerpt of the relevant (fields, Meta options, __*__ methods) models, admin app ModelAdmin's and *Inline's involved which result in the layout depicted in the screenshot you posted?
class Dataset(models.Model):
active = models.BooleanField(_('Ativo'), default=True)
title = models.CharField(_('Nome'), max_length=250)
users = models.ManyToManyField(MyCustomUser)
class Meta:
verbose_name = _('Dataset')
verbose_name_plural = _('Datasets')
def __str__(self):
return self.title
class MyCustomUser(AbstractBaseUser, PermissionsMixin):
username = models.CharField(
_('Nome do usuário'), max_length=200, blank=True, null=True)
email = models.EmailField(
_('Endereço de E-Mail'), blank=False, unique=True)
first_name = models.CharField(_('Nome'), max_length=30, blank=True)
last_name = models.CharField(
_('Sobrenome'), max_length=30, blank=True, default='')
is_staff = models.BooleanField(_('Administrador?'), default=False)
is_active = models.BooleanField(_('Usuário Ativo?'), default=True)
date_joined = models.DateTimeField(
_('Data Cadastro'), default=timezone.now)
objects = CustomUserManager()
USERNAME_FIELD = 'email'
REQUIRED_FIELDS = ['first_name']
class Meta:
verbose_name = _('Usuário')
verbose_name_plural = _('Usuários')
def __str__(self):
if self.first_name or self.last_name:
return self.get_full_name()
return self.email
class DatasetInline(admin.TabularInline):
model = Dataset.users.through
verbose_name = _('Dataset')
verbose_name_plural = _('Datasets')
class MyCustomUserAdmin(UserAdmin):
model = User
add_fieldsets = (None, {
'classes': ('wide',),
'fields': (
'email', 'password1', 'password2', 'first_name', 'last_name',
'is_superuser'),
}),
fieldsets = (
(None, {'fields': ('email', 'password')}),
(_('Personal info'), {'fields': (
'first_name', 'last_name')}),
(_('Permissions'), {'fields': ('is_active', 'is_superuser')}),
(_('Important dates'), {'fields': ('last_login', 'date_joined')}),
)
ordering = ('first_name', 'email')
list_display = ('email', 'first_name', 'last_name')
inlines = [DatasetInline]
list_filter = ('is_active', 'is_superuser')
admin.site.register(User, MyCustomUserAdmin)
On Tue, Jul 12, 2016 at 1:34 PM, Ramiro Morales <cra...@gmail.com> wrote:Can you post a simplified excerpt of the relevant (fields, Meta options, __*__ methods) models, admin app ModelAdmin's and *Inline's involved which result in the layout depicted in the screenshot you posted?
Sure, here is:
[...]
Where the 'Conjunto de dados' seen in the screenshot title comes from? Is the code you posted actually in sync with it?
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAF1jwZF2WwricBicEKxPL7eWsp%2BQrTuD7YgCQueNfKAWzyTDrA%40mail.gmail.com.
There's a ticket for this in the tracker iirc, but I can't find it now. I think the reason is because that's the name of the DB field - it's not localizable (in so much as we don't localize db field names).
On Tue, Jul 12, 2016 at 1:52 PM, Ramiro Morales <cra...@gmail.com> wrote:Where the 'Conjunto de dados' seen in the screenshot title comes from? Is the code you posted actually in sync with it?
Sorry about that, I take the screenshot before change these text to "DataSet"...