Django

Code

Ticket #3959 (closed: wontfix)

Opened 1 year ago

Last modified 6 months ago

[patch] newforms: label as first argument

Reported by: Marty Alchin <gulopine@gamemusic.org> Assigned to: nobody
Component: django.newforms Version: SVN
Keywords: newforms label,sprintdec01 Cc:
Triage Stage: Design decision needed Has patch: 1
Needs documentation: 0 Needs tests: 0
Patch needs improvement: 0

Description

It seems strange to me that model fields can have their verbose_name set as a single positional argument, but newforms labels require the label= prefix unless required and widget are also specified. This patch simply moves label to the front, so that forms may specify field labels as just a single positional argument, just like model field verbose_names.

Attachments

label.diff (2.7 kB) - added by Marty Alchin <gulopine@gamemusic.org> on 04/07/07 22:48:48.
Simply moves label to the front of the argument list for fields

Change History

04/07/07 22:48:48 changed by Marty Alchin <gulopine@gamemusic.org>

  • attachment label.diff added.

Simply moves label to the front of the argument list for fields

04/10/07 22:51:08 changed by SmileyChris

  • needs_better_patch changed.
  • stage changed from Unreviewed to Design decision needed.
  • needs_tests changed.
  • needs_docs changed.

It does seem like an ok idea, but backwards-incompatibility concerns.

04/11/07 07:41:21 changed by Marty Alchin <gulopine@gamemusic.org>

I had considered there might be some backwards-incompatibility concerns, but since the existing implementation essentially requires people to use label= anyway, moving it shouldn't affect that. The only true concern would be people supplied required (and possibly widget) as positional arguments, which should probably be discouraged anyway, for readability concerns. That said, however, I understand that this patch comes 5 months after label was implemented, and that convention may already be too well established.

04/24/07 02:29:49 changed by mtredinnick

Probably not worth changing. I'm going to think about it a bit more, but if another developer wants to make a decision, I'm not going to mind. I'm probably -0 on this at the moment.

Writing "label=" is hardly going to kill people. The logic that people shouldn't be using positional arguments currently is flawed, so it does have a backwards-incompatibility impact, however it's not like 1.0 isn't going to have a few of those.

04/24/07 15:20:36 changed by Marty Alchin <gulopine@gamemusic.org>

I'll admit, I'm +0 on this myself. I wish I had delved into newforms early enough to catch this before it hit store shelves, but now that it's out and running, I'm not going to push too hard on the subject.

I do agree that writing label= isn't going to cause any code problems, nor is it likely to induce carpal tunnel. I'll also concede that my presumption about people already using keyword arguments all the time was all too broad, and thus inherently flawed. It's probably true in most cases, but it's far from a guarantee.

The biggest reason I put this together was just consistency. This would fall in line with verbose_name, and thus make Django feel a bit more unified, that's all. So like I said, I'm +0 really, I'm not going to lose sleep over this one.

04/24/07 17:10:45 changed by SmileyChris

I agree that it'd be more consistent. The question is are we perfectionists to the level of breaking backwards compatibility? (I'm +0 too)

09/16/07 13:54:53 changed by ubernostrum

I'd be -0 on this because of the backwards incompatibility.

12/01/07 11:09:48 changed by thejaswi_puthraya

  • keywords changed from newforms label to newforms label,sprintdec01.

I guess this ticket can be closed because it is a non-trivial one.

12/01/07 14:19:43 changed by mtredinnick

  • status changed from new to closed.
  • resolution set to wontfix.

The gain here isn't worth the backwards-incompatibility pain.


Add/Change #3959 ([patch] newforms: label as first argument)




Change Properties
Action