You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The data_file_paths attribute on the Library model is currently an ArrayField of TextFields, which saves an array of file paths from an external s3 bucket representing a library instance's data files currently hosted on s3. While the Django ORM does offer a mechanism to save local file paths to the db with FilePathField, it does not offer a way to save remote file paths, which is our use case.
Problem or idea
With this being said, Django does offer the ability to create custom model fields, which we would be able to utilize to suite our use case. For us it would be acceptable for the actual representation of the path to be as a TextField in the database, but we need our getters and setters to deal directly with Path objects. As such, leveraging a custom model field will allow us to wrap these getting and setting operations with the creation and destruction of Path objects as they are transformed to and from str / TextField objects.
Solution or next step
Below is the Django tutorial for creating a custom model field. Once this ticket is given the green light, I will develop a solution for it.
Context
The
data_file_paths
attribute on theLibrary
model is currently anArrayField
ofTextFields
, which saves an array of file paths from an externals3
bucket representing a library instance's data files currently hosted ons3
. While the Django ORM does offer a mechanism to save local file paths to the db withFilePathField
, it does not offer a way to save remote file paths, which is our use case.Problem or idea
With this being said, Django does offer the ability to create custom model fields, which we would be able to utilize to suite our use case. For us it would be acceptable for the actual representation of the path to be as a
TextField
in the database, but we need our getters and setters to deal directly withPath
objects. As such, leveraging a custom model field will allow us to wrap these getting and setting operations with the creation and destruction ofPath
objects as they are transformed to and fromstr
/TextField
objects.Solution or next step
Below is the Django tutorial for creating a custom model field. Once this ticket is given the green light, I will develop a solution for it.
The text was updated successfully, but these errors were encountered: