lizard_structure.views provides base views for each of the core concepts defined in Introducing the four core Lizard concepts. The basic premise is that lizard-structure only shows a data source’s structure. There are no edit actions, so no POST/PUT/DELETE: only GET.
For the Django API we use Django REST framework.
Every view has a doctring that can mostly be used as-is by the subclasses that implement the actual functionality. The docstring is rendered by Django REST framework in the html API interface, so the view’s docstring is the most important information your API user is going to see. The base views’ docstring must be really clear and concise!
You normally do not have to implement any .get() method on a view, that is all taken care of. Every view tells you which methods you have to fill in to get the base view working with your data.
Base view for a Data source.
Information about the data source itself and its list of layer trees.
Use this to discover the layer trees you can show in your user interface. The result is a dictionary with the following items:
There is one method you always have to implement:
Return list of layer trees.
Overwrite this method in your subclass and return a list of lizard_structure.items.LayerTreeItem instances you create from whatever constitutes a layer tree in your own models. To give you an idea, here are some example layer trees:
If you want to return more information about ourselves than the default:
Return metadata about ourselves.
The result should be a flat dictionary, so only key/value pairs. By default “generator” is returned with our package name and version as returned by our_name_and_version().
Normally, you should not have to modify or implement the other methods.
Base view for a Layer tree.