Opened 5 years ago

Closed 5 years ago

#24950 closed Cleanup/optimization (fixed)

Add unicode_literals to startapp's template models.py

Reported by: Markus Holtermann Owned by: nobody
Component: Core (Other) Version: master
Severity: Normal Keywords:
Cc: Markus Holtermann Triage Stage: Ready for checkin
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: yes UI/UX: no

Description

When creating a new app using the startapp django-admin command, the included models.py file does not contain a from __future__ import unicode_literals. In order to drive the use of unicode forwards we should include that line.

Attachments (1)

24950.diff (1.3 KB) - added by Tim Graham 5 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 Changed 5 years ago by Aymeric Augustin

Would it make sense to do this only on Python 2?

comment:2 Changed 5 years ago by Markus Holtermann

I don't see how you would distinguish between projects running on Python 2 only and those supporting Python 2 and Python 3 in parallel. As far as I know, adding this import does not break anything on Python 3 (any release).

comment:3 Changed 5 years ago by Tim Graham

I think that for end-user projects (which I assume is the common case for using startapp) the need to support Python 2 and 3 is rather uncommon. I'd rather promote Python 3 than add cruft that only has benefit on Python 2. Feel free to enhance your arguments if you feel otherwise.

Changed 5 years ago by Tim Graham

Attachment: 24950.diff added

comment:4 Changed 5 years ago by Tim Graham

There's a tentative implementation that needs I test I guess, although I have mixed feelings about whether to accept or reject this ticket as I'd like to think most new projects are using Python 3. :-) Of course, there may be existing projects starting new apps on Python 2.

comment:5 Changed 5 years ago by Markus Holtermann

I'd like to think that, too, Tim. But I don't see that happening for the next year or two.

comment:6 Changed 5 years ago by Tim Graham

Triage Stage: UnreviewedAccepted

I just think our time could be better spent, but if you have interest, might as well just do it rather than spend time debating.

comment:7 Changed 5 years ago by Tim Graham

Triage Stage: AcceptedReady for checkin

comment:8 Changed 5 years ago by Markus Holtermann <info@…>

Resolution: fixed
Status: newclosed

In 5d42890:

Fixed #24950 -- Added unicode_literals to models.py in app template

Thanks Tim Graham for the patch

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