[GSoC20] General indications for students

31 views
Skip to first unread message

Federico Capoano

unread,
May 8, 2020, 1:41:48 PM5/8/20
to OpenWISP
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:


I concluded that what we're doing in the Firmware Upgrade module 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 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
- ensure your project has a CONTRIBUTING.rst file

Federico

Gagan Deep

unread,
May 8, 2020, 7:52:35 PM5/8/20
to open...@googlegroups.com
Greetings,

I have gone through the Firmware Upgrader repository and the README looks good to me,  We can surely use it as a reference for other modules. To further improve the quality of documentation we can provide a link to the documentation of django-swappable for reference, Well, this might not be a major improvement but it will help users(developers) learn more about it. 

Thanks and Regards,
Gagan Deep

--
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 openwisp+u...@googlegroups.com.
To view this discussion on the web, visit https://groups.google.com/d/msgid/openwisp/6315789d-cd41-4b56-be0a-d874e9b646a6%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages