Opened 5 years ago

Closed 5 years ago

#22326 closed New feature (wontfix)

Add kwarg for text-direction in modelfields

Reported by: anonymous Owned by: nobody
Component: contrib.admin Version: 1.6
Severity: Normal Keywords: RTL, right-to-left, text-direction
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: yes


bidi UX issue here.

some of my projects use models which have fields like

name_en = models.CharField(max_length=256)
name_xx = models.CharField(max_length=256) #where xx is an RTL language, and text entry is done using such.

wonder if it would be a good idea to have something like:

name_xx = models.CharField(max_length=256,admin_text_direction='rtl')

which would set the css of the text input in admin to "text-direction:rtl" which makes it easier to do text-entry.

Change History (1)

comment:1 Changed 5 years ago by Russell Keith-Magee

Resolution: wontfix
Status: newclosed

This sounds like something that should be a the forms layer, not the model layer. Text entry isn't model concern, it's a form concern. The fact that you're using the term "admin" in your field definition is the big giveaway there.

You can attach a class to a form field right now by specifying a class attribute on a field in your form (or modelform) definition, and then making your admin use this (model)form.

I'm not sure if I see the value of adding a specific API for defining a single text field as being RTL. It strikes me as a an edge-case requirement - the sort of thing you need if you're writing a translation tool - in normal l10n usage, either *all* your text fields are RTL, or none of them are.

For that reason, I'm marking this wontfix. If I've missed something in my analysis, please reopen this ticket with more details.

Note: See TracTickets for help on using tickets.
Back to Top