Skip to content

DjangoLDP Refactor

In this issue I'd like to review the potential scope for a major refactor of DjangoLDP. I think on balance this could save us a lot of time & money in future. With the recent changes from @plup taking us in a radical new direction it's a good time to look at changes to the foundations

Automatic vs Easy-to-Extend

I think that there is a general conflict in DjangoLDP between two design requirements

  • "everything should be automatic"
  • "everything should be easy to extend"

At the moment it feels like we're not quite achieving either. I think the synthesis of the two directions is achieved well by Django Rest Framework, and we largely don't support the structures which it uses to achieve this

These changes may implicate that no ViewSet should be automatically registered as a URL unless the model explicitly configures view_set in its' Meta. If it doesn't, it should be assumed that it is being accessed via its' own views, as with Django

Sometimes the automatic requirement is also in conflict with "everything should perform well" (djangoldp-packages/djangoldp#299 (closed)). By separating the serializer we are resolving this conflict for the case of filtering query-sets

Nested Fields

Most of the bugs I come across in the serializer are relating to nested fields, particularly with POST/PUT. This is also a feature of DRF's ModelSerializer, and it's important for making things automatic, so I'm not sure if anything can be done about it. 8h of budget has already been released to add a lot more tests, so this should be a focus of that effort

Tight coupling between View, Model and Serializer

Not totally addressed by the suggestions above

URLs

DjangoLDP Permissions

I recently opened an issue for a permissions refactor (#305 ) which has an open merge request

There are still some open issues relating to permissions, but these are bugs/feature requests rather than suggestions for refactoring:

DjangoLDP Filters

DjangoLDP Admin

Documentation

Many of these issues raise the subject of documentation. DjangoLDP's documentation is currently stored in 3 places: we have some guides on setting up a sib-server, some docs in the README and some guides in the Wiki

There's an issue open to move the Wiki guides to the main documentation repo

We may also want to have more extensive documentation on DjangoLDP as a whole, particularly as we've diverged from Django & Django Rest Framework in a few ways

Edited by Benoit Alessandroni