On Sun, 2007-04-08 at 15:40 +0000, [EMAIL PROTECTED] wrote: > You must mean those: > > http://code.djangoproject.com/ticket/1714 > http://code.djangoproject.com/ticket/342 > > I'm currently trying to create a patch but I'm not really confortable > with changing options so I'd rather have input from the devs. > > Currently, "editable=False" for a field really means private, because > it never shows in the admin forms. The behavior I'm trying to > implement would be more like a const value in OO: you can set it when > creating the object and then only read it. I'd suggest that we rename > "editable" to "private" and add a "const" option but those are really > OO concepts/words. Anyone has more database-related ideas ?
Just leave it as "editable" and have it behave as its name says: if editable is True, you can edit it, otherwise only display it in forms. The current behaviour is only because we don't display non-editable field. Editable only applies to form (and other front-end, if the developer wants to use the attribute for that) handling. It would be counter-intuitive to try and graft a true "const" into models, because we are writing in Python, after all, and Python does not have a const type. The editable attribute describes form access bheaviour. So just make it displayable as a static string in the form/page when editable is False. This shouldn't be too hard. You dont' (and shouldn't) have to worry about HTML widgets or anything like that. Just display them as static fields. In the past, people have tried to argue that these should be "readonly" or "disabled" and use the same widget as if they were editable, but that's not useful: they are not editable, so are never going to become enabled or readable and you would only have to check that the field values hadn't changed (or ignore them, so iterating through the field list is now harder) if they were part of the form input. Regards, Malcolm --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django developers" group. To post to this group, send email to django-developers@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-developers?hl=en -~----------~----~----~----~------~----~------~--~---