*Progress report*

- from next week, please send the progress report to the mailing list
- please send your daily check in in the gitter channel dedicated to the 
project you're working on

*Swappable models across OpenWISP*

I wanted to take some time to investigate what's the best way to implement 
this across OpenWISP.

*I was exploring the possibility of allowing users to just swap models, 
without the need of creating a custom app altogether.*

After reading the following:

- https://github.com/wq/django-swappable-models#swapper
- https://github.com/wq/django-swappable-models/issues/18
- https://code.djangoproject.com/ticket/25313

I concluded that what we're doing in the Firmware Upgrade module 
<https://github.com/openwisp/openwisp-firmware-upgrader> is most probably 
the best thing currently available at the moment, for the following reasons:

- we force the creation of separate migration files, which can diverge from 
the base app without creating issues that are too complicated to resolve
- migrating from the base module to the customized version of the module 
should be just a matter of creating the tables and migrate the data to it
- we explain in the README how to reuse and extend all the important classes

Using django-swappable is therefore not extremely needed, but it's still 
helpful because it allows us to write base classes (eg: views) which load 
the concrete models using the swappable API, so when a module is extended, 
those views can be just imported and won't need to be touched much.
Without django-swappable, we would have had to write more boilerplate code, 
because the wouldn't have been able to load concrete models in base classes 
(because doing so would make it impossible to extend the modules since 
django will try to load the concrete models but won't find the app in 
INSTALLED_APPS and hence raise an exception) so it's still useful, even 
though we will not officially support the possibility of swapping only one 
particular model and not all of them. although it may still be doable, but 
I will not dedicate more time to this now; we may make an exception for the 
User model, which would be an interesting use case to support, we'll 
investigate in the near future.

Let's use the Firmware Upgrader README 
<https://github.com/openwisp/openwisp-firmware-upgrader#extending-openwisp-firmware-upgrader>
 
as a base for other READMEs as well.
If you have suggestions regarding improvements to the README, please send 
them asap.

*Other general indications*

- when introducing swappable models, add this premise 
<https://github.com/openwisp/openwisp-firmware-upgrader/commit/2496206c256f26c87cd9cd53a6055733ba22140f>
- simplify the contributing section of the README to point to our 
contributing guidelines 
<https://github.com/openwisp/openwisp-firmware-upgrader/commit/576168a0cd04f9ad062d6fcc3f2c5c8c792a22c0#diff-88b99bb28683bd5b7e3a204826ead112L431-R432>
- ensure your project has a CONTRIBUTING.rst file 
<https://github.com/openwisp/openwisp-firmware-upgrader/blob/master/CONTRIBUTING.rst>

Federico

-- 
You received this message because you are subscribed to the Google Groups 
"OpenWISP" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web, visit 
https://groups.google.com/d/msgid/openwisp/6315789d-cd41-4b56-be0a-d874e9b646a6%40googlegroups.com.

Reply via email to