mirror of
https://github.com/ae-utbm/sith.git
synced 2025-07-09 19:40:19 +00:00
django2.2: replace removed is_anonymous() and is_authenticated to their now used counterparts
This commit is contained in:
@ -37,7 +37,7 @@ AnonymousUser = getattr(importlib.import_module(module), klass)
|
||||
def get_cached_user(request):
|
||||
if not hasattr(request, "_cached_user"):
|
||||
user = get_user(request)
|
||||
if user.is_anonymous():
|
||||
if user.is_anonymous:
|
||||
user = AnonymousUser(request)
|
||||
|
||||
request._cached_user = user
|
||||
|
@ -39,7 +39,7 @@
|
||||
</div>
|
||||
|
||||
<header>
|
||||
{% if not user.is_authenticated() %}
|
||||
{% if not user.is_authenticated %}
|
||||
<div id="header_logo" style="background-image: url('{{ static('core/img/logo.png') }}'); width: 185px; height: 100px;">
|
||||
<a href="{{ url('core:index') }}"></a>
|
||||
</div>
|
||||
|
@ -11,7 +11,7 @@
|
||||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
{% if user.is_authenticated() %}
|
||||
{% if user.is_authenticated %}
|
||||
<p>{% trans %}Your account doesn't have access to this page. To proceed,
|
||||
please login with an account that has access.{% endtrans %}</p>
|
||||
{% else %}
|
||||
|
@ -150,7 +150,7 @@ class CanCreateMixin(View):
|
||||
|
||||
def dispatch(self, request, *arg, **kwargs):
|
||||
res = super(CanCreateMixin, self).dispatch(request, *arg, **kwargs)
|
||||
if not request.user.is_authenticated():
|
||||
if not request.user.is_authenticated:
|
||||
raise PermissionDenied
|
||||
return res
|
||||
|
||||
|
@ -289,7 +289,7 @@ class FileView(CanViewMixin, DetailView, FormMixin):
|
||||
self.form = self.get_form() # The form handle only the file upload
|
||||
files = request.FILES.getlist("file_field")
|
||||
if (
|
||||
request.user.is_authenticated()
|
||||
request.user.is_authenticated
|
||||
and request.user.can_edit(self.object)
|
||||
and self.form.is_valid()
|
||||
):
|
||||
|
@ -689,7 +689,7 @@ class UserUpdateProfileView(UserTabsMixin, CanEditMixin, UpdateView):
|
||||
files = request.FILES.items()
|
||||
self.form.process(files)
|
||||
if (
|
||||
request.user.is_authenticated()
|
||||
request.user.is_authenticated
|
||||
and request.user.can_edit(self.object)
|
||||
and self.form.is_valid()
|
||||
):
|
||||
|
Reference in New Issue
Block a user