Re: How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Jonty Needham
Thanks so much. Sorted competely!

On Mon, Jan 11, 2016 at 5:44 PM, Erik Cederstrand  wrote:

>
> > Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham  >:
> >
> > I have a ModelAdmin class where I am using callables to define accessors
> to a foreign key's field.
> >
> > I.e.
> >
> > class MyAdmin(admin.ModelAdmin):
> >
> > def field_name(self, obj):
> > return obj.fk.field_name
> >
> > readonly_fields=(field_name, other_field)
> >
> >
> > Ultimately I need to translate the labels, but I need access to them
> first and I can't see from the ModelAdmin code where that is.
>
> It sounds like you're looking for the 'short_description' option described
> in
> https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display
>
> Erik
>
> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@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/9E3DD769-26A9-4DD5-A1D7-08327ECB5358%40cederstrand.dk
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/CANOQRbz5fecLyvotOkFXuSdcdgisFcL2Vt7zqBXGSh01gahFNg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to define custom labels for admin.ModelAdmin readonly fields.

2016-01-11 Thread Erik Cederstrand

> Den 11. jan. 2016 kl. 23.21 skrev Jonty Needham :
> 
> I have a ModelAdmin class where I am using callables to define accessors to a 
> foreign key's field.
> 
> I.e.
> 
> class MyAdmin(admin.ModelAdmin):
> 
> def field_name(self, obj):
> return obj.fk.field_name
> 
> readonly_fields=(field_name, other_field)
> 
> 
> Ultimately I need to translate the labels, but I need access to them first 
> and I can't see from the ModelAdmin code where that is.

It sounds like you're looking for the 'short_description' option described in 
https://docs.djangoproject.com/en/1.9/ref/contrib/admin/#django.contrib.admin.ModelAdmin.list_display

Erik

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@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/9E3DD769-26A9-4DD5-A1D7-08327ECB5358%40cederstrand.dk.
For more options, visit https://groups.google.com/d/optout.