collectstatic failes on various test suite files which are not needed to
install Mayan EDMS. Switch over to preparestatic, which contains a
predefined ignore list.
Add deletion of Python3 cache files to the clean target.
Allowing passing extra arguments to the test targets.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Allow passing runtime queryset to FilteredPrimaryKeyRelatedField
using a method name via the source_queryset_method attribute
or a default method name of "get_<field_name>_queryset".
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
FilteredPrimaryKeyRelatedField is a subclass of PrimaryKeyRelatedField
that filters its queryset by a permission.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Setting expected_content_type to None will now disable
the reponse HTTP content type checking. Added
to allow API tests to be a subclass of the test view test
case and support all the mixins without having to declare
them separately.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
For tests that required using two test permission, like
the tests for .restrict_queryset_by_accesses().
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
This change allows filtering a queryset by multiple permission
following a logic operator to define the relationship.
Example: In order to access an instance of MetadataTypeDocumentType
the document type view and metadata type view permissions are
required. The computation for this access control can now be
coded using .restrict_queryset_by_accesses. Custom permission
checking in the view is no longer required.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Don't delete test models at the end of the test case.
Failed test cases don't execute the tearDown() method.
Instead perform model registry cleanup before creating
any new test model.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add type casting to ExternalObjectListSerializerMixin via
the external_object_list_pk_type option.
Add an ExternalObjectSerializeMixin for related objects.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Update .get_inherited_permissions() to grab the permissions
of an object up the parent tree. Also add the role
permissions. Finally filter all the permissions by those
that apply to the object.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Convert the API to use viewsets.
The search function is now a service of the search model
resource.
The simple and advance search are now the same service. The
difference is determined by the URL query. A ?q= means a
simple search. For advanced search pass the search model
fields in the URL query, example: ?q=document_type__label=
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>