Opened 9 years ago

Closed 9 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: dev
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 9 years ago.

Download all attachments as: .zip

Change History (9)

comment:1 by Aymeric Augustin, 9 years ago

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

comment:2 by Markus Holtermann, 9 years ago

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 by Tim Graham, 9 years ago

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.

by Tim Graham, 9 years ago

Attachment: 24950.diff added

comment:4 by Tim Graham, 9 years ago

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 by Markus Holtermann, 9 years ago

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

comment:6 by Tim Graham, 9 years ago

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 by Tim Graham, 9 years ago

Triage Stage: AcceptedReady for checkin

comment:8 by Markus Holtermann <info@…>, 9 years ago

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