Skip to content

Commit

Permalink
Changes sync
Browse files Browse the repository at this point in the history
  • Loading branch information
kmmbvnr committed Oct 17, 2022
1 parent 82d08f8 commit aac8d8b
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 2 deletions.
2 changes: 1 addition & 1 deletion tests/test_urls__base.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,6 @@ def test_urlconf_resolve(self):
self.assertEqual('/test/', urlconfig.nested_path.viewset.reverse('index'))
self.assertEqual('/test/page/', urlconfig.nested_path.viewset.reverse('page'))

def test_autoredirect(self):
def test_auto_redirect(self):
response = self.client.get(reverse('root:nested:index'))
self.assertRedirects(response, '/test/page/')
3 changes: 3 additions & 0 deletions viewflow/views/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from urllib.parse import quote as urlquote

from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied
from django.forms.models import modelform_factory
from django.utils.decorators import method_decorator
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django.views import generic
Expand All @@ -20,6 +22,7 @@
from .base import FormLayoutMixin


@method_decorator(login_required, name='dispatch')
class CreateModelView(FormLayoutMixin, FormDependentSelectMixin, FormAjaxCompleteMixin, generic.CreateView):
viewset = None
layout = None
Expand Down
5 changes: 4 additions & 1 deletion viewflow/views/delete.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,20 @@

from django.contrib import messages
from django.contrib.admin.utils import unquote
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied, ValidationError
from django.db import router
from django.db.models.deletion import Collector
from django.http import Http404, HttpResponseRedirect
from django.views import generic
from django.utils.decorators import method_decorator
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django.views import generic

from viewflow.utils import has_object_perm, viewprop


@method_decorator(login_required, name='dispatch')
class DeleteModelView(generic.DeleteView):
viewset = None

Expand Down
3 changes: 3 additions & 0 deletions viewflow/views/detail.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@
# which is part of this source code package.

from django.contrib.admin.utils import unquote
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied, ValidationError
from django.http import Http404
from django.utils.decorators import method_decorator
from django.views import generic

from viewflow.utils import has_object_perm, get_object_data


@method_decorator(login_required, name='dispatch')
class DetailModelView(generic.DetailView):
viewset = None
page_actions = None
Expand Down
3 changes: 3 additions & 0 deletions viewflow/views/list.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@
import decimal
from functools import lru_cache

from django.contrib.auth.decorators import login_required
from django.core.exceptions import FieldDoesNotExist, PermissionDenied
from django.db import models
from django.forms.utils import pretty_name
from django.utils import formats, timezone
from django.utils.decorators import method_decorator
from django.utils.encoding import force_str
from django.utils.functional import cached_property
from django.utils.html import format_html
Expand Down Expand Up @@ -413,6 +415,7 @@ def dispatch(self, request, *args, **kwargs):
return super().dispatch(request, *args, **kwargs)


@method_decorator(login_required, name='dispatch')
class ListModelView(BulkActionsMixin,
FilterableViewMixin,
OrderableListViewMixin,
Expand Down
3 changes: 3 additions & 0 deletions viewflow/views/update.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@

from django.contrib import messages
from django.contrib.admin.utils import unquote
from django.contrib.auth.decorators import login_required
from django.core.exceptions import PermissionDenied, ValidationError
from django.forms.models import modelform_factory
from django.http import Http404
from django.utils.decorators import method_decorator
from django.utils.html import format_html
from django.utils.translation import gettext_lazy as _
from django.views import generic
Expand All @@ -21,6 +23,7 @@
from .base import FormLayoutMixin


@method_decorator(login_required, name='dispatch')
class UpdateModelView(FormLayoutMixin, FormDependentSelectMixin, FormAjaxCompleteMixin, generic.UpdateView):
viewset = None
layout = None
Expand Down

0 comments on commit aac8d8b

Please sign in to comment.