Fix the NSFW setting

In the user settings, the temporary NSFW allowance was not detected.
This was due to use of a database lookup instead of the correct
function.
This commit is contained in:
Rodolphe Breard 2018-11-09 20:09:04 +03:00
parent c2867dcde6
commit a397d766a0

View file

@ -14,6 +14,7 @@ from django.utils.encoding import force_bytes
from django.http import HttpResponse, Http404 from django.http import HttpResponse, Http404
from django.conf import settings from django.conf import settings
from django.urls import reverse_lazy from django.urls import reverse_lazy
from nsfw.views import is_nsfw_allowed
from .forms import RegistrationForm, ChangePasswordForm, DeleteAccountForm from .forms import RegistrationForm, ChangePasswordForm, DeleteAccountForm
from .models import NelUser from .models import NelUser
@ -27,7 +28,7 @@ def settings_default(request):
@login_required @login_required
def set_nsfw(request): def set_nsfw(request):
ctx = { ctx = {
'nsfw_allowed': request.user.nsfw_allowed, 'nsfw_allowed': is_nsfw_allowed(request),
'current_url': reverse_lazy('set_nsfw'), 'current_url': reverse_lazy('set_nsfw'),
'tab': 'preferences', 'tab': 'preferences',
'active_block': 'nsfw_filter' 'active_block': 'nsfw_filter'