On 7/05/2020 7:24 pm, Derek wrote:
> I do something similar but not exactly the same. Perhaps like this
> (WARNING: untested code) under the class MyModelAdmin:
>
> def get_form(self, request, obj=None, **kwargs):
> form = super(MyModelAdminForm, self).get_form(request, obj,
> **kwargs)
> if form.base_fields:
> form.base_fields['currency'].label =
> get_regional_currency() # or other method...
> return form
Thank you Derek. I'll keep plugging away but I can't get it working yet
in admin.StackedInline.
I think I might have to go down the widget path.
Cheers
Mike
>
>
> On Wednesday, 6 May 2020 03:37:59 UTC+2, Mike Dewhirst wrote:
>
> One of my Admin forms has a price field and the currency and symbol
> depend on the selected region.
>
> I would like to display (readonly) just the field content for
> currency
> and symbol for example ...
>
> "AUD $ [ 222.22]"
>
> ... but all I can achieve at the moment is ...
>
> "Currency: AUD Symbol: $ [
> 222.22]"
>
> Is there a technique for this?
>
> I have checked the docs and found I can use a callable but that just
> uses the callable name as the verbose_name.
>
> I have tried making verbose_name="" in the model but that still
> displays
> the colon and lots of spaces.
>
> I expect I'll need to use my own form somehow but I'd prefer
> something
> simpler.
>
> Any hints greatly appreciated
>
> Cheers
>
> Mike
>
> --
> 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
> <mailto:
django-users...@googlegroups.com>.
> To view this discussion on the web visit
>
https://groups.google.com/d/msgid/django-users/48adbb40-11d4-47d7-bba1-e068d5ae523f%40googlegroups.com
> <
https://groups.google.com/d/msgid/django-users/48adbb40-11d4-47d7-bba1-e068d5ae523f%40googlegroups.com?utm_medium=email&utm_source=footer>.