Changes between Version 2 and Version 3 of Ticket #31701


Ignore:
Timestamp:
Jun 13, 2020, 12:19:25 PM (5 years ago)
Author:
Sultan
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #31701

    • Property Summary Extend DeferredAttribute & Remove unnecessary overriding of contrib_to_class () in FileFieldExtend DeferredAttribute & Remove unnecessary FileField.contrib_to_class ()
  • Ticket #31701 – Description

    v2 v3  
    33To access the field data in instance dict, **Field.attname** is used as a key.
    44
    5 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**.
     5In 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.
     6This feature is not used in FileField. Then why use FileField.name instead of FileField.attname for FileDescriptor?
    67
    7 This enables us to process and present the data in different ways: article.author returns a User object, and article.auther_id returns a User object pk.
    8 
    9 This feature is not used in model.FileField. Then why use FileField.name instead of FileField.attname for FileDescriptor?
    10 
    11 I think it would be better if FileDescriptor uses field.attname and continue working with the DeferredAttribute class.
     8I think it would be better if FileDescriptor uses FileField.attname and continue working with the DeferredAttribute class.
Back to Top