From 66b7c81f08e1f5747bcd7ea670686d77685648f5 Mon Sep 17 00:00:00 2001 From: Andrey Date: Mon, 27 Mar 2017 02:04:45 +0300 Subject: [PATCH] myauth: use exists --- project/myauth/views.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/project/myauth/views.py b/project/myauth/views.py index 304884d..4bcd007 100644 --- a/project/myauth/views.py +++ b/project/myauth/views.py @@ -94,8 +94,8 @@ def confirm_registered_email(request, key): models.ConfirmEmail.objects.confirm(user) messages.add_message(request, messages.INFO, success_msg) - licenses = License.objects.filter(company=user.profile) - if not licenses: + any_licenses = License.objects.filter(company=user.profile).exists() + if not any_licenses: license = License.objects.create_test_period_license(company=user.profile) user.profile.confirmed = True user.profile.active = True