Django And MySQL: Model Saving Order Is Important
Nov. 19, 2021 0 comments
Often in one Django view you need to save multiple models that have "parent-child" relationship. For example, your view may receive data from a traditional HTML form that includes an inline formset or a JSON with a nested array of child objects from a JavaScript frontend app. In this case you need to save a parent model and create/update/delete some child models. Of course, to make the whole operation atomic all model saves should be wrapped in a database transaction to ensure the consistency of saved data. Let's assume we are using MySQL or MariaDB as a database backend for our Django project. And the question arises: "in which order we should save our models?". "What should we save first: parent or children?" (...)
Setting Up MySQL in LibreELEC on Raspberry Pi
Nov. 17, 2017 0 comments
Updated on 2020-06-13
Kodi mediacenter can maintain a common medialibrary on MySQL/MariaDB database server. This way a media library, including "watched" and "in progress" marks, can be synchronized between several Kodi instances. The official Kodi Wiki provides instructions on how to set up MySQL server on various platforms, however those instructions do not include LibreELEC — a popular mediacenter software based on Kodi that runs on various platforms, including different versions of Raspberry Pi single-board computers. (...)
Featured Posts
-
Running Multiple Celery Beat Instances in One Python Project
Feb. 1, 2021 -
Setting Up MySQL in LibreELEC on Raspberry Pi
Nov. 17, 2017 -
Autodocumenting your Python code with Sphinx - part 2
Feb. 24, 2016