Re: [Django] #33946: admin change_form field label does not use mark_safe

2022-08-23 Thread Django
#33946: admin change_form field label does not use mark_safe
---+--
 Reporter:  Caram  |Owner:  nobody
 Type:  Bug|   Status:  closed
Component:  contrib.admin  |  Version:  4.1
 Severity:  Normal |   Resolution:  invalid
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  1
---+--
Changes (by Carlton Gibson):

 * status:  new => closed
 * resolution:   => invalid


Comment:

 The issue tracker is for bug reports on Django, not support requests.
 Please see TicketClosingReasons/UseSupportChannels for appropriate places
 for questions like this. (It's always possible to open a ticket if it
 turns out to be a bug.)

 Also, Caram, please do not post to the DevelopersMailingList saying you've
 opened a ticket here. That just spams a whole lot of people.

 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182c9a9a6cf-627a4652-e9ed-4856-be05-ad7eca980008-00%40eu-central-1.amazonses.com.


Re: [Django] #33946: admin change_form field label does not use mark_safe

2022-08-23 Thread Django
#33946: admin change_form field label does not use mark_safe
---+--
 Reporter:  Caram  |Owner:  nobody
 Type:  Bug|   Status:  new
Component:  contrib.admin  |  Version:  4.1
 Severity:  Normal |   Resolution:
 Keywords: | Triage Stage:  Unreviewed
Has patch:  0  |  Needs documentation:  0
  Needs tests:  0  |  Patch needs improvement:  0
Easy pickings:  1  |UI/UX:  1
---+--

Comment (by Alex Morega):

 In your example you're setting `verbose_name` on the `myfield` field. It
 looks like it's meant to be a string; the
 [https://docs.djangoproject.com/en/4.1/topics/db/models/#verbose-field-
 names Verbose field names] documentation implies that.

 >In other words, change_list.html handles this case well.

 That's probably accidental. If you want a custom field label in the admin
 change form, you're better off customizing the
 
[https://docs.djangoproject.com/en/4.1/ref/contrib/admin/#django.contrib.admin.ModelAdmin.form
 ModelAdmin.form]:

 {{{#!python
 from django.contrib import admin
 from django.forms.models import ModelForm

 class MyModelForm(ModelForm):
 def __init__(self, *args, **kwargs):
 super().__init__(*args, **kwargs)
 self.fields['myfield'].label = format_html(
 ''
 )

 @admin.register(models.MyModel)
 class MyModelAdmin(admin.ModelAdmin):
 form = MyModelForm
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/01070182c9a5202f-b02d4057-136c-4373-bd2d-32e26a9f2c09-00%40eu-central-1.amazonses.com.