On Wed, Jun 1, 2016 at 12:12 PM Michael Selik <michael.selik@gmail.com> wrote:
On Wed, Jun 1, 2016 at 9:23 AM Sven R. Kunze <srkunze@mail.de> wrote:
On 01.06.2016 08:25, Sjoerd Job Postmus wrote:
>> On 31 May 2016, at 16:37, Sven R. Kunze <srkunze@mail.de> wrote:
>> Btw. there would be huge use-case for Django development. So, given your explanation, it sounds useful.
> Could you elaborate on that use-case, because I'm not seeing it. I think maybe you mean the ORM and declarative forms, correct?

Exactly. That is one reason why Django needs metaclasses all over the
place. Because fields just don't know their name.

This is especially true for forms as django does not magic there. It
always causes headaches if you need it.

Are you referring to code like this [0]?
    your_name = forms.CharField(label='Your name')

If so, I don't think we actually want the LHS to get passed in as the label. Not all labels will be valid identifiers. If you're talking about the CharField knowing what attribute it has been assigned to, I couldn't find that code in the Django source. Could you point it out?

I tracked it down

BaseForm looks like a Mixin that needs the subclass to implement the collection of the base_fields class attribute. Form uses the DeclarativeFieldsMetaclass to inspect the constructed attributes and capture the appropriate ones as base_fields.

I don't see how that would be improved by a special syntax for the LHS to know the identifier it's being assigned to. Could you clarify that?