diff --git a/doc/creating_views.rst b/doc/creating_views.rst index 987387e54de..5d9002d1a5f 100644 --- a/doc/creating_views.rst +++ b/doc/creating_views.rst @@ -10,7 +10,7 @@ them based on your needs. .. _`Django REST Framework`: http://django-rest-framework.org/ The first thing you will need is a working SQLAlchemy model. Based on wether -that model will be available on only one workspace (like the majority of out +that model will be available on only one workspace (like the majority of our models) or in all the workspaces (like vuln templates or licenses) the things are a bit different. @@ -62,7 +62,7 @@ app in the ``server/app.py`` file:: That is the code of the view. It will have list, detail, create, update, remove and count endpoints, and all of them will be functional. If you want to only enable some of them you should inherit from ``GenericWorkspacedView`` and from -some mixins that define each endpoint's behavior. +some mixins that implement each method's behavior. If you look at the view's code, the only thing it does is to define three atrributes: ``route_base``, to define what is going on the URL, the class of diff --git a/doc/overview.rst b/doc/overview.rst index 67c6432b9be..d1b2f41dd7b 100644 --- a/doc/overview.rst +++ b/doc/overview.rst @@ -19,8 +19,9 @@ ecosystem. `SQLAlchemy`_ ^^^^^^^^^^^^^ -A really powerful Object Relational Mapper for Python that allows us to map -results of SQL queries to instances of Python objects +A really powerful but complex Object Relational Mapper for Python that allows +us to map results of SQL queries to instances of Python objects. Sometimes it +looks made by Java developers rather than Python devs. `Flask-Classful`_ ^^^^^^^^^^^^^^^^^ @@ -86,6 +87,10 @@ Other libraries we use * `Filteralchemy`_ to make query filters in a declarative way, inspired on `django-filter`_ + .. note:: + This library is unmantained, so we have our own fork of it hosted on + https://github.com/infobyte/filteralchemy + .. _`django-filter`: https://github.com/carltongibson/django-filter .. _`Filteralchemy`: http://filteralchemy.readthedocs.io/ diff --git a/doc/recipes.rst b/doc/recipes.rst index 21bb5fd4bcc..2cb0e4b779e 100644 --- a/doc/recipes.rst +++ b/doc/recipes.rst @@ -69,9 +69,10 @@ For example, lets see the code of the vulns API:: if pagination_metadata is not None else len(vulns)) } -Ensure that you correctly handle the case of ``pagination_metadata`` being -None. This happens when the user doesn't specify the page number or size, so -all the objects will be shown. +.. warning:: + Ensure that you correctly handle the case of ``pagination_metadata`` being + None. This happens when the user doesn't specify the page number or size, so + all the objects will be shown. .. _`flask_sqlalchemy.Pagination`: http://flask-sqlalchemy.pocoo.org/2.3/api/#utilities @@ -80,7 +81,7 @@ Adding filters ============== If you want to enable the API clients to filter by a specific field, you should -inherit from the ``PaginatedMixin`` (this isn't done by default like with +inherit from the ``FilterAlchemyMixin`` (this isn't done by default like with ``SortableMixin``). Then you define a ``filterset_class`` attribute in your class indicating the `filteralchemy filterset`_ to use::