Changeset View
Changeset View
Standalone View
Standalone View
docs/architecture.md
| # Architecture Overview | # Architecture Overview | ||||
| Apps: | Apps: | ||||
| - [assets](#assets) | - [static_assets](#static-assets) | ||||
| - [blog](#blog) | - [blog](#blog) | ||||
| - [comments](#comments) | - [comments](#comments) | ||||
| - [films](#films) | - [films](#films) | ||||
| - [subscriptions](#subscriptions) | - [subscriptions](#subscriptions) | ||||
| - [training](#training) | - [training](#training) | ||||
| To be extracted to a separate app: | To be extracted to a separate app: | ||||
| - [progress](#progress) - currently inside [training](#training) | - [progress](#progress) - currently inside [training](#training) | ||||
| Show All 39 Lines | |||||
| The main difference between chapters and films' collections is that collections can be nested. | The main difference between chapters and films' collections is that collections can be nested. | ||||
| The Section model is linked to a **Video** via a OneToOneField. Together, they form an equivalent | The Section model is linked to a **Video** via a OneToOneField. Together, they form an equivalent | ||||
| of an Asset with a Static Asset in films, more or less. | of an Asset with a Static Asset in films, more or less. | ||||
| In training, there also is an **Asset** model, but it differs from the Asset model in films. | In training, there also is an **Asset** model, but it differs from the Asset model in films. | ||||
| It represents an extra file attached to a Section. | It represents an extra file attached to a Section. | ||||
| ## Assets | ## Static Assets | ||||
| **Static Assets** represent the files uploaded in the cloud. | **Static Assets** represent the files uploaded in the cloud. | ||||
| Static assets can be of three types (`source_type` attribute): image, video, or (a generic) file. | Static assets can be of three types (`source_type` attribute): image, video, or (a generic) file. | ||||
| **Images** and **Videos** should be represented by their respective models: `Image` and `Video`, | **Images** and **Videos** should be represented by their respective models: `Image` and `Video`, | ||||
| which provide additional attributes like resolution or duration. These models additionally | which provide additional attributes like resolution or duration. These models additionally | ||||
| have a one-to-one reference to a Static Asset instance, containing all the other data. | have a one-to-one reference to a Static Asset instance, containing all the other data. | ||||
| Preview pictures for all assets are obligatory. However, for images and videos they can be | Preview pictures for all static assets are obligatory. However, for images and videos they can be | ||||
| generated automatically (e.g. by the `sorl-thumbnail` library). | generated automatically (e.g. by the `sorl-thumbnail` library). | ||||
| We want the entire `assets` app (i.e. file-representing models: `StaticAsset`, `Image`, `Video`) | We want the entire `static_assets` app (i.e. file-representing models: `StaticAsset`, `Image`, `Video`) | ||||
| to be portable, and independent of the other apps. In particular, the `DynamicStorageFileField` | to be portable, and independent of the other apps. In particular, the `DynamicStorageFileField` | ||||
| should be left inside this app, even though it is used in other apps' models as well. | should be left inside this app, even though it is used in other apps' models as well. | ||||
| ##### Licenses | ##### Licenses | ||||
| For now, licenses are only added to static assets (image, video, file). | For now, licenses are only added to static assets (image, video, file). | ||||
| ##### Storage locations | ##### Storage locations | ||||
| Storage location is a place to store all the film-related or training-related files. | Storage location is a place to store all the film-related or training-related files. | ||||
| Show All 40 Lines | |||||
| Assets in a collection are sorted by their `order` and `name` attributes. The `order` field | Assets in a collection are sorted by their `order` and `name` attributes. The `order` field | ||||
| is not required, there is also no constraint on it to enforce unequivocal ordering in a collection, | is not required, there is also no constraint on it to enforce unequivocal ordering in a collection, | ||||
| hence the additional `name` field. | hence the additional `name` field. | ||||
| Maintaining consistent ordering is difficult, especially if the order of collections or asset changes, | Maintaining consistent ordering is difficult, especially if the order of collections or asset changes, | ||||
| and it would be even more difficult with the above mentioned restrictions in place. It would be | and it would be even more difficult with the above mentioned restrictions in place. It would be | ||||
| useful to have the `order` attributes in the entire collection reassigned automatically whenever | useful to have the `order` attributes in the entire collection reassigned automatically whenever | ||||
| a user changes the `order` of one asset. | a user changes the `order` of one asset. | ||||
| ##### Asset (model in films app) vs. StaticAsset (model in assets app) | ##### Asset (model in films app) vs. StaticAsset (model in static_assets app) | ||||
| - Static Asset is more "low-level" and represents an uploaded file; we want to have a less | - Static Asset is more "low-level" and represents an uploaded file; we want to have a less | ||||
| generic model that could be extracted and reused in other apps (e.g. blog, training). | generic model that could be extracted and reused in other apps (e.g. blog, training). | ||||
| Therefore Static Asset should not contain any relationships to other apps. | Therefore Static Asset should not contain any relationships to other apps. | ||||
| - Asset contains the metadata, and represents the web page where the file (artwork, training video, etc.) | - Asset contains the metadata, and represents the web page where the file (artwork, training video, etc.) | ||||
| is displayed. As a model in the 'films' app, asset may belong to a Collection, and is a part (leaf) | is displayed. As a model in the 'films' app, asset may belong to a Collection, and is a part (leaf) | ||||
| of the tree-like structure of film-related resources. | of the tree-like structure of film-related resources. | ||||
| <table> | <table> | ||||
| ▲ Show 20 Lines • Show All 70 Lines • Show Last 20 Lines | |||||