#31701: Extend DeferredAttribute & Remove unnecessary FileField.contrib_to_class () -------------------------------------+------------------------------------- Reporter: Sultan | Owner: nobody Type: | Status: new Cleanup/optimization | Component: Database layer | Version: master (models, ORM) | Severity: Normal | Resolution: Keywords: | Triage Stage: | Unreviewed Has patch: 1 | Needs documentation: 0 Needs tests: 0 | Patch needs improvement: 0 Easy pickings: 1 | UI/UX: 0 -------------------------------------+------------------------------------- Description changed by Sultan:
Old description: > The model fields use, by default, the descriptor **DeferredAttribute** to > access and process (if necessary) the data associated with them. This > type of data represents the actual data in db column. I prefer to call it > a “field data”. > > To access the field data in instance dict, **Field.attname** is used as a > key. > > In addition to the field data, some other model fields (for example, > ForeignKey) also use a "client data" of the attribute, the processing of > which is performed by a particular descriptor. Such a descriptor is > usually assigned to a model using **Field.name**. Its task is to present > the same field data in a different format, the result of which differs > from the result of Field.attname descriptor: `article.author` returns a > User object, and `article.auther_id` returns a User object pk. > This feature is not used in FileField. Then why use FileField.name > instead of FileField.attname for FileDescriptor? > > I think it would be better if FileDescriptor uses FileField.attname and > continue working with the DeferredAttribute class. New description: The model fields use, by default, the descriptor **DeferredAttribute** to access and process (if necessary) the data associated with them. This type of data represents the actual data in db column. I prefer to call it a “field data”. To access the field data in instance dict, **Field.attname** is used as a key. In addition to the field data, some other model fields (for example, ForeignKey) also use a "client data" of the attribute, the processing of which is performed by a particular descriptor. Such a descriptor is assigned to a model using **Field.name**. Its task is to present the same field data in a different format, the result of which differs from the result of Field.attname descriptor: `article.author` returns a User object, and `article.auther_id` returns a User object pk. This feature is not used in FileField. Then why use FileField.name instead of FileField.attname for FileDescriptor? I think it would be better if FileDescriptor uses FileField.attname and continue working with the DeferredAttribute class. -- -- Ticket URL: <https://code.djangoproject.com/ticket/31701#comment:4> Django <https://code.djangoproject.com/> The Web framework for perfectionists with deadlines. -- You received this message because you are subscribed to the Google Groups "Django updates" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-updates+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/django-updates/067.452955758bec34a3d637c8577ecb48cd%40djangoproject.com.