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>
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>
Reduce repeated code.
Add support for passing query string dictionary to
the test client.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Rename the get_menu_links and get_menus_links to
navigation_resolve_menu.
Change the return value of the menu resolving to include
the resolved object.
Update the links display templates to show which object the
links belong to when there is more than one object.
Update the links display templates to show which menu
the links belong to when there is more than one menu.
Remove the sidebar menu and unify its links with the
secondary menu.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Make sure to always used the base filtered source queryset.
Remove the grouped attribute which is subclass specific.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
View that use the MultipleObjectMixin can now fully operate
as single object or multiple object views.
Add the self.view_mode_single and self.view_mode_multiple flags.
Add support for single, singular and plural titles and success
messages via:
success_message_single, success_message_singular,
sucess_message_plural, title_single, title_singular and
title_plural class attributes.
Insert object_list and object as attributes of the view class
to avoid calling the queryset again.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add a new view based on AssignRemove with extra features
and filtering. AddRemoveView also has two new buttons:
Add all, Remove all.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Instead of calculating these values in the dispatch
method, add new methods to calculate and insert the values of
next_url and previous_url in the context.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Only override success_url if self.get_post_object_action_url()
provides an alternative.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add post_object_action_url property to redirect the view after
all items in the queryset have been processed.
Add the exception instance in the error message context.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
When there is no HTTP referer fallback to
common.settings_home_view instead of LOGIN_REDIRECT_URL.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Normally the MultipleObjectMixin class view only allows
id_list from the GET request. This is updated to allow
that query from POST requests like those produced by the
view tests.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add keyword arguments.
Sort arguments.
Unify the ObjectListPermissionFilterMixin and
ObjectPermissionCheckMixin into the RestrictedQuerysetMixin.
Add MultipleObjectDownloadView.
Update SingleObjectDownloadView to do queryset filtering.
The method that returns the base queryset for views is
now named get_source_queryset().
The views now use .get_object_list as a multi object
homologous of get_object. The queryset returned by
.get_object_list is restricted by access.
Make MultipleObjectMixin a subclass of Django's
SingleObjectMixin to reduce repeated code.
All generic views are now imported from common.generics and not
from common.views.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Update the SingleObject Delete, Detail and Download views
to force use of a get_object_list method instead of allowing
subclasses to override the get_queryset method and bypass
the object permission checks.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add a new mixin to monkey patch the Model class to
force each newly created model instance to use a randomly
generated primary key.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Instead of class attributes, make a generic reusable the
FormOption class and update the DetailForm to use a Meta
class for options.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Fix displaying the name of the subclass when the
queryset is missing.
Add support for passing a new argument to specify
if the field is required or not.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
With the interface finalized, replace .filter_by_access() in
the generic view mixins with restrict_queryset().
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Improve the configuration process of the FilteredSelectionForm form
by adding Meta child class support. The child Meta class
is defined in FilteredSelectionFormOptions.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Remove explict support for raising 404 error when the
object access fails.
The new method to use is to restrict the queryset using
the .restrict_queryset manager method and then .get() the
desired object. If the object access control failed then
the desired object will not be found in the queryset
and an error 404 will be raised. The end result is the same:
error 404, the method to raise the error is what differs now.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Update the API entries for content types and templates to use
viewsets and the new api_router_entries URL registraion
method.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add the get_related_field function to resolve a
model's related field reference by a path separate
by Django's default field separator '__'.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Add the mayan.apps.common.warnings module with an
initial InterfaceWarning warning class used to mark
use of deprecated internal interfaces.
Signed-off-by: Roberto Rosario <Roberto.Rosario@mayan-edms.com>
Rename migration 0011_auto_20181229_0738 to 0012_auto_20181229_0738
to avoid conflict with an existing 0011_* migration.
Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@gmail.com>
Calculate the Template hash from the content actually returned.
Remove the newlines as these are irrelevant for HTML.
Signed-off-by: Roberto Rosario <Roberto.Rosario.Gonzalez@gmail.com>