diff --git a/apps/approval/dashboard/views.py b/apps/approval/dashboard/views.py
index 02c65f11c..4bdda0fb8 100644
--- a/apps/approval/dashboard/views.py
+++ b/apps/approval/dashboard/views.py
@@ -8,7 +8,7 @@
from django.shortcuts import render
from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.decorators.csrf import ensure_csrf_cookie
from django.views.generic import (
CreateView,
diff --git a/apps/approval/forms.py b/apps/approval/forms.py
index cec25b665..56f412c91 100644
--- a/apps/approval/forms.py
+++ b/apps/approval/forms.py
@@ -2,7 +2,7 @@
from django import forms
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.constants import FieldOfStudyType
diff --git a/apps/approval/models.py b/apps/approval/models.py
index 88b75641a..4ae0185a8 100644
--- a/apps/approval/models.py
+++ b/apps/approval/models.py
@@ -5,7 +5,7 @@
from django.db.models import Case, ExpressionWrapper, F, Q, When
from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.approval import settings as approval_settings
from apps.authentication.constants import FieldOfStudyType
diff --git a/apps/approval/views.py b/apps/approval/views.py
index c38d3ebf6..7f996bb44 100644
--- a/apps/approval/views.py
+++ b/apps/approval/views.py
@@ -7,7 +7,7 @@
from django.http import Http404
from django.shortcuts import get_object_or_404, redirect
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.approval.forms import FieldOfStudyApplicationForm
from apps.approval.models import MembershipApproval
diff --git a/apps/article/models.py b/apps/article/models.py
index 5953e53d3..0bd2948bf 100755
--- a/apps/article/models.py
+++ b/apps/article/models.py
@@ -8,7 +8,7 @@
from django.db.models import SET_NULL
from django.template.defaultfilters import slugify
from django.urls import reverse
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from taggit.managers import TaggableManager
from unidecode import unidecode
diff --git a/apps/authentication/admin.py b/apps/authentication/admin.py
index fa050ccdc..4a1efca14 100644
--- a/apps/authentication/admin.py
+++ b/apps/authentication/admin.py
@@ -2,7 +2,7 @@
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from reversion.admin import VersionAdmin
from apps.authentication.models import (
diff --git a/apps/authentication/api/tests/user_data_tests.py b/apps/authentication/api/tests/user_data_tests.py
index 5bd2b28d0..26814b472 100644
--- a/apps/authentication/api/tests/user_data_tests.py
+++ b/apps/authentication/api/tests/user_data_tests.py
@@ -72,7 +72,7 @@ def test_user_cannot_create_an_email_with_an_existing_address(self):
def test_user_can_change_primary_email(self):
self.assertTrue(self.email.primary)
- email: Email = G(Email, user=self.user, verfied=False)
+ email: Email = G(Email, user=self.user, verified=False)
response = self.client.patch(
self.id_url(email.id), {"primary": True}, **self.headers
@@ -89,7 +89,7 @@ def test_user_can_change_primary_email(self):
def test_user_cannot_remove_primary_email_without_selecting_a_new_primary(self):
self.assertTrue(self.email.primary)
- email: Email = G(Email, user=self.user, verfied=False)
+ email: Email = G(Email, user=self.user, verified=False)
response = self.client.patch(
self.id_url(email.id), {"primary": False}, **self.headers
@@ -108,7 +108,7 @@ def test_user_cannot_remove_primary_email_without_selecting_a_new_primary(self):
self.assertTrue(self.email.primary)
def test_user_cannot_verify_emails_without_token(self):
- email: Email = G(Email, user=self.user, verfied=False)
+ email: Email = G(Email, user=self.user, verified=False)
response = self.client.patch(
self.id_url(email.id), {"verified": True}, **self.headers
)
@@ -121,7 +121,7 @@ def test_user_cannot_verify_emails_without_token(self):
def test_user_cannot_change_the_address_of_an_existing_email(self):
address = "test@example.com"
other_address = "test@test.io"
- email: Email = G(Email, user=self.user, verfied=False, email=address)
+ email: Email = G(Email, user=self.user, verified=False, email=address)
self.client.patch(
self.id_url(email.id), {"email": other_address}, **self.headers
)
diff --git a/apps/authentication/constants.py b/apps/authentication/constants.py
index 0ec9dd837..b384d0824 100644
--- a/apps/authentication/constants.py
+++ b/apps/authentication/constants.py
@@ -1,4 +1,4 @@
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
class GroupType:
diff --git a/apps/authentication/forms.py b/apps/authentication/forms.py
index 98a5a373b..1f28a2075 100644
--- a/apps/authentication/forms.py
+++ b/apps/authentication/forms.py
@@ -4,7 +4,7 @@
from django import forms
from django.contrib import auth
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.models import Email
from apps.authentication.models import OnlineUser as User
diff --git a/apps/authentication/models.py b/apps/authentication/models.py
index 961d1ea48..93f2ba2f4 100644
--- a/apps/authentication/models.py
+++ b/apps/authentication/models.py
@@ -12,7 +12,7 @@
from django.urls import reverse
from django.utils import timezone
from django.utils.html import strip_tags
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from rest_framework.exceptions import NotAcceptable
from apps.authentication.constants import FieldOfStudyType, GroupType, RoleType
diff --git a/apps/authentication/views.py b/apps/authentication/views.py
index b381717d4..b97a85078 100644
--- a/apps/authentication/views.py
+++ b/apps/authentication/views.py
@@ -12,7 +12,7 @@
from django.shortcuts import get_object_or_404, redirect, render
from django.template.loader import render_to_string
from django.urls import reverse
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.decorators.debug import sensitive_post_parameters
from apps.authentication.forms import (
diff --git a/apps/careeropportunity/models.py b/apps/careeropportunity/models.py
index f81b4383d..a70c7da51 100644
--- a/apps/careeropportunity/models.py
+++ b/apps/careeropportunity/models.py
@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from taggit.managers import TaggableManager
from apps.companyprofile.models import Company
diff --git a/apps/companyprofile/models.py b/apps/companyprofile/models.py
index 912355ce0..3d59a8cca 100644
--- a/apps/companyprofile/models.py
+++ b/apps/companyprofile/models.py
@@ -1,5 +1,5 @@
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from apps.gallery.models import ResponsiveImage
diff --git a/apps/dashboard/widgets.py b/apps/dashboard/widgets.py
index 5705393c9..8e4cbdebf 100644
--- a/apps/dashboard/widgets.py
+++ b/apps/dashboard/widgets.py
@@ -4,7 +4,7 @@
from django.forms.utils import format_html
from django.forms.widgets import TextInput
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
DATEPICKER_WIDGET_STRING = """
\r\n
@@ -105,7 +105,7 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs = self.build_attrs(attrs, {"type": self.input_type, "name": name})
if value != "":
final_attrs["value"] = format_html(
- 'value="{}"', force_text(self.format_value(value))
+ 'value="{}"', force_str(self.format_value(value))
)
else:
final_attrs["value"] = ""
@@ -114,13 +114,13 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs["placeholder"] = "Vennligst velg en dato ..."
if attrs.get("placeholder", False):
# Update the placeholder text if supplied.
- final_attrs["placeholder"] = force_text(attrs.get("placeholder"))
+ final_attrs["placeholder"] = force_str(attrs.get("placeholder"))
return format_html(
DATEPICKER_WIDGET_STRING,
- id=force_text(final_attrs["id"]),
- name=force_text(final_attrs["name"]),
- placeholder=force_text(final_attrs["placeholder"]),
+ id=force_str(final_attrs["id"]),
+ name=force_str(final_attrs["name"]),
+ placeholder=force_str(final_attrs["placeholder"]),
value=final_attrs["value"],
)
@@ -149,7 +149,7 @@ def render(self, name, value, attrs=None, renderer=None):
attrs = self.build_attrs(self.attrs, attrs)
final_attrs = self.build_attrs(attrs, {"type": self.input_type, "name": name})
if value != "":
- final_attrs["value"] = force_text(self.format_value(value))
+ final_attrs["value"] = force_str(self.format_value(value))
else:
final_attrs["value"] = ""
@@ -157,13 +157,13 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs["placeholder"] = "Vennligst velg dato og klokkeslett ..."
if self.attrs.get("placeholder", False):
# Update the placeholder text if supplied.
- final_attrs["placeholder"] = force_text(self.attrs.get("placeholder"))
+ final_attrs["placeholder"] = force_str(self.attrs.get("placeholder"))
return format_html(
DATETIMEPICKER_WIDGET_STRING,
- id=force_text(final_attrs["id"]),
- name=force_text(final_attrs["name"]),
- placeholder=force_text(final_attrs["placeholder"]),
+ id=force_str(final_attrs["id"]),
+ name=force_str(final_attrs["name"]),
+ placeholder=force_str(final_attrs["placeholder"]),
value=final_attrs["value"],
)
@@ -193,7 +193,7 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs = self.build_attrs(attrs, {"type": self.input_type, "name": name})
if value != "":
final_attrs["value"] = format_html(
- 'value="{}"', force_text(self.format_value(value))
+ 'value="{}"', force_str(self.format_value(value))
)
else:
final_attrs["value"] = ""
@@ -202,12 +202,12 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs["placeholder"] = "Vennligst velg klokkeslett ..."
if attrs.get("placeholder", False):
# Update the placeholder text if supplied.
- final_attrs["placeholder"] = force_text(attrs.get("placeholder"))
+ final_attrs["placeholder"] = force_str(attrs.get("placeholder"))
return format_html(
TIMEPICKER_WIDGET_STRING,
- id=force_text(final_attrs["id"]),
- name=force_text(final_attrs["name"]),
- placeholder=force_text(final_attrs["placeholder"]),
+ id=force_str(final_attrs["id"]),
+ name=force_str(final_attrs["name"]),
+ placeholder=force_str(final_attrs["placeholder"]),
value=final_attrs["value"],
)
diff --git a/apps/dataporten/study/tests/task_tests.py b/apps/dataporten/study/tests/task_tests.py
index b3a6c75ef..32cc39fb8 100644
--- a/apps/dataporten/study/tests/task_tests.py
+++ b/apps/dataporten/study/tests/task_tests.py
@@ -40,7 +40,7 @@ def test_fetch_groups_information(self, mocked_request):
class StudyUpdatingTestCase(TestCase):
def test_find_user_study_and_update_1st_grader(self):
- user = G(OnlineUser)
+ user = G(OnlineUser, ntnu_username="testesen")
groups = [
INFORMATICS_BACHELOR_STUDY_PROGRAMME,
load_course(ITGK_ACTIVE, years_ago=0),
@@ -57,7 +57,7 @@ def test_find_user_study_and_update_1st_grader(self):
self.assertEqual(len(mail.outbox), 0)
def test_find_user_study_and_update_5th_grader(self):
- user = G(OnlineUser)
+ user = G(OnlineUser, ntnu_username="testesen")
groups = [
INFORMATICS_MASTER_STUDY_PROGRAMME,
load_course(PVS_ACTIVE, active=True),
diff --git a/apps/events/admin.py b/apps/events/admin.py
index 28b8cfdf7..12bad2a28 100644
--- a/apps/events/admin.py
+++ b/apps/events/admin.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.contrib import admin, messages
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from guardian.admin import GuardedModelAdmin
from reversion.admin import VersionAdmin
diff --git a/apps/events/dashboard/views.py b/apps/events/dashboard/views.py
index 38326e6fe..daed44c21 100644
--- a/apps/events/dashboard/views.py
+++ b/apps/events/dashboard/views.py
@@ -12,7 +12,7 @@
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.generic import CreateView, DeleteView, UpdateView
from guardian.decorators import permission_required
from guardian.shortcuts import get_objects_for_user
diff --git a/apps/events/forms.py b/apps/events/forms.py
index fa2202621..b31610219 100644
--- a/apps/events/forms.py
+++ b/apps/events/forms.py
@@ -2,7 +2,7 @@
from captcha.fields import ReCaptchaField
from django import forms
from django.conf import settings
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.models import OnlineUser as User
from apps.marks.models import MarkRuleSet
diff --git a/apps/events/models.py b/apps/events/models.py
index 02ec4ea79..cfcce87bf 100644
--- a/apps/events/models.py
+++ b/apps/events/models.py
@@ -21,7 +21,7 @@
from django.template.loader import render_to_string
from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from guardian.shortcuts import assign_perm
from unidecode import unidecode
diff --git a/apps/events/tests/api_tests.py b/apps/events/tests/api_tests.py
index 6dbcc9e7a..93b587ad4 100644
--- a/apps/events/tests/api_tests.py
+++ b/apps/events/tests/api_tests.py
@@ -487,7 +487,7 @@ def test_event_with_group_restriction(self):
self.assertEqual(response.status_code, status.HTTP_200_OK)
restricted_to_group: Group = G(Group)
- G(GroupRestriction, event=self.event, group=restricted_to_group)
+ G(GroupRestriction, event=self.event, groups=[restricted_to_group])
response = self.client.get(self.id_url(self.event.id), **self.headers)
self.assertEqual(response.status_code, status.HTTP_404_NOT_FOUND)
@@ -502,7 +502,9 @@ def test_event_with_group_restriction(self):
class AttendAPITestCase(OIDCTestCase):
def setUp(self):
self.committee = G(Group, name="Arrkom")
- self.user = G(OnlineUser, name="test_user", groups=[self.committee])
+ self.user = G(
+ OnlineUser, first_name="Test", last_name="Testesen", groups=[self.committee]
+ )
self.token = self.generate_access_token(self.user)
self.headers = {
**self.generate_headers(),
diff --git a/apps/events/tests/utils.py b/apps/events/tests/utils.py
index f074a1d38..895caf232 100644
--- a/apps/events/tests/utils.py
+++ b/apps/events/tests/utils.py
@@ -58,7 +58,9 @@ def add_payment_delay(payment: Payment, user: OnlineUser) -> PaymentDelay:
def generate_user(username: str) -> OnlineUser:
- user = G(OnlineUser, username=username, ntnu_username=username)
+ user = G(
+ OnlineUser, username=username, ntnu_username=username, phone_number="12345678"
+ )
G(Email, user=user)
return user
diff --git a/apps/events/views.py b/apps/events/views.py
index e8dc46c82..2bca1ea64 100644
--- a/apps/events/views.py
+++ b/apps/events/views.py
@@ -11,7 +11,7 @@
from django.shortcuts import get_object_or_404, redirect, render
from django.urls import reverse
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from guardian.shortcuts import get_objects_for_user
from rest_framework import mixins, permissions, status, viewsets
from rest_framework.decorators import action
diff --git a/apps/feedback/models.py b/apps/feedback/models.py
index fce6a3ec3..938ec978a 100644
--- a/apps/feedback/models.py
+++ b/apps/feedback/models.py
@@ -18,7 +18,7 @@
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.urls import reverse
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.constants import FieldOfStudyType
from apps.authentication.models import OnlineUser
diff --git a/apps/feedback/serializers.py b/apps/feedback/serializers.py
index ab6f41d9a..fb3c73c78 100644
--- a/apps/feedback/serializers.py
+++ b/apps/feedback/serializers.py
@@ -1,7 +1,7 @@
import logging
from collections import OrderedDict
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from rest_framework import serializers
from .models import (
diff --git a/apps/feedback/tests/base_tests.py b/apps/feedback/tests/base_tests.py
index 1efb0aa4d..8a7777747 100644
--- a/apps/feedback/tests/base_tests.py
+++ b/apps/feedback/tests/base_tests.py
@@ -8,7 +8,7 @@
from django.test.client import Client
from django.urls import reverse
from django.utils import timezone as timezone
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from django_dynamic_fixture import G
from apps.authentication.models import Email, OnlineGroup
diff --git a/apps/feedback/views.py b/apps/feedback/views.py
index 0b7d47d64..8e1d58443 100644
--- a/apps/feedback/views.py
+++ b/apps/feedback/views.py
@@ -9,7 +9,7 @@
from django.db.models import Prefetch
from django.http import Http404, HttpResponse
from django.shortcuts import get_object_or_404, redirect, render
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from rest_framework import mixins, permissions, status, viewsets
from rest_framework.decorators import action
from rest_framework.response import Response
diff --git a/apps/gallery/models.py b/apps/gallery/models.py
index 198972e4e..2f5a5a348 100644
--- a/apps/gallery/models.py
+++ b/apps/gallery/models.py
@@ -5,7 +5,7 @@
from django.conf import settings
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from taggit.managers import TaggableManager
from apps.gallery import settings as gallery_settings
diff --git a/apps/gallery/widgets.py b/apps/gallery/widgets.py
index 36a507604..da6857b2d 100644
--- a/apps/gallery/widgets.py
+++ b/apps/gallery/widgets.py
@@ -6,7 +6,7 @@
from django.forms import HiddenInput, TextInput
from django.forms.utils import flatatt, format_html
from django.urls import reverse_lazy
-from django.utils.encoding import force_text
+from django.utils.encoding import force_str
from apps.gallery.models import ResponsiveImage
@@ -62,7 +62,7 @@ def render(self, name, value, attrs=None, renderer=None):
final_attrs = self.build_attrs(attrs, {"type": self.input_type, "name": name})
if value != "":
# Only add the value attribute if the value is non-empty
- final_attrs["value"] = force_text(self.format_value(value))
+ final_attrs["value"] = force_str(self.format_value(value))
img = ResponsiveImage.objects.get(pk=value)
img_thumb = format_html(
'
',
diff --git a/apps/gsuite/mail_syncer/tests/apiclient_utils_tests.py b/apps/gsuite/mail_syncer/tests/apiclient_utils_tests.py
index 72162aa50..525ffac9a 100644
--- a/apps/gsuite/mail_syncer/tests/apiclient_utils_tests.py
+++ b/apps/gsuite/mail_syncer/tests/apiclient_utils_tests.py
@@ -282,7 +282,12 @@ def test_get_g_suite_users_for_group_no_members(self, mocked_g_suite_client):
@patch("apps.gsuite.mail_syncer.utils.setup_g_suite_client", autospec=True)
def test_get_g_suite_groups_for_user(self, mocked_g_suite_client):
- user = G(OnlineUser)
+ user = G(
+ OnlineUser,
+ first_name="Test",
+ last_name="Testesen",
+ online_mail="test.testesen",
+ )
ow4_gsuite_sync = settings.OW4_GSUITE_SYNC
ow4_gsuite_sync["ENABLED"] = True
@@ -306,7 +311,12 @@ def test_get_g_suite_groups_for_user(self, mocked_g_suite_client):
@patch("apps.gsuite.mail_syncer.utils.setup_g_suite_client", autospec=True)
def test_get_g_suite_groups_for_user_no_members(self, mocked_g_suite_client):
- user = G(OnlineUser)
+ user = G(
+ OnlineUser,
+ first_name="Test",
+ last_name="Testesen",
+ online_mail="test.testesen",
+ )
ow4_gsuite_sync = settings.OW4_GSUITE_SYNC
ow4_gsuite_sync["ENABLED"] = True
diff --git a/apps/gsuite/mail_syncer/tests/utils_tests.py b/apps/gsuite/mail_syncer/tests/utils_tests.py
index 2d9560fb2..f7cc19f93 100644
--- a/apps/gsuite/mail_syncer/tests/utils_tests.py
+++ b/apps/gsuite/mail_syncer/tests/utils_tests.py
@@ -44,7 +44,12 @@ def test_get_user_no_params(self):
self.assertRaises(ValueError, lambda: get_user(object))
def test_get_user(self):
- user = G(OnlineUser)
+ user = G(
+ OnlineUser,
+ first_name="Test",
+ last_name="Testesen",
+ online_mail="test.testesen",
+ )
self.assertEqual(user, get_user(user, ow4=True))
self.assertEqual(user.online_mail, get_user(user, gsuite=True))
diff --git a/apps/inventory/models.py b/apps/inventory/models.py
index c1c08bfbc..c1484bb06 100644
--- a/apps/inventory/models.py
+++ b/apps/inventory/models.py
@@ -4,7 +4,7 @@
from django.core.mail import EmailMessage
from django.db import models
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.gallery.models import ResponsiveImage
diff --git a/apps/marks/admin.py b/apps/marks/admin.py
index 7c9d1711f..08f36d013 100644
--- a/apps/marks/admin.py
+++ b/apps/marks/admin.py
@@ -1,7 +1,7 @@
# -*- coding: utf-8 -*-
from django.contrib import admin
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from reversion.admin import VersionAdmin
from apps.marks.models import Mark, MarkRuleSet, MarkUser, Suspension
diff --git a/apps/marks/models.py b/apps/marks/models.py
index 943ec3f52..c2f7e0fd3 100644
--- a/apps/marks/models.py
+++ b/apps/marks/models.py
@@ -5,7 +5,7 @@
from django.conf import settings
from django.db import models
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
User = settings.AUTH_USER_MODEL
diff --git a/apps/offline/models.py b/apps/offline/models.py
index 7c032f377..bf987a161 100644
--- a/apps/offline/models.py
+++ b/apps/offline/models.py
@@ -5,7 +5,7 @@
from chunks.models import Chunk
from django.conf import settings
from django.db import models
-from django.utils.translation import ugettext_lazy as _
+from django.utils.translation import gettext_lazy as _
from apps.gallery.models import ResponsiveImage
diff --git a/apps/offline/tests.py b/apps/offline/tests.py
index dbe2d2528..6a3f746e8 100644
--- a/apps/offline/tests.py
+++ b/apps/offline/tests.py
@@ -13,7 +13,12 @@
def create_generic_offline_issue():
release_date = datetime(2000, 1, 1)
- return G(Issue, release_date=release_date)
+ return G(
+ Issue,
+ release_date=release_date,
+ issue=IMAGE_FOLDER + "/offline-test-pdf.pdf",
+ image=None,
+ )
class OfflineTest(TestCase):
diff --git a/apps/online_oidc_provider/claims.py b/apps/online_oidc_provider/claims.py
index a36ee4d90..82d52a399 100644
--- a/apps/online_oidc_provider/claims.py
+++ b/apps/online_oidc_provider/claims.py
@@ -1,4 +1,4 @@
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from oidc_provider.lib.claims import ScopeClaims
from apps.sso.userinfo import Onlineweb4Userinfo
diff --git a/apps/payment/models.py b/apps/payment/models.py
index f49466aed..bdd9eff49 100644
--- a/apps/payment/models.py
+++ b/apps/payment/models.py
@@ -11,7 +11,7 @@
from django.db import models
from django.template.loader import render_to_string
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.models import OnlineGroup
from apps.events.models import AttendanceEvent, Attendee
diff --git a/apps/payment/mommy.py b/apps/payment/mommy.py
index 78ea0d4d1..107f7ed1c 100644
--- a/apps/payment/mommy.py
+++ b/apps/payment/mommy.py
@@ -8,7 +8,7 @@
from django.core.mail import EmailMessage
from django.template.loader import render_to_string
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from pytz import timezone as tz
from apps.events.models import AttendanceEvent, Attendee
diff --git a/apps/payment/tests/view_tests.py b/apps/payment/tests/view_tests.py
index 749cdd949..89b345afe 100644
--- a/apps/payment/tests/view_tests.py
+++ b/apps/payment/tests/view_tests.py
@@ -20,7 +20,7 @@ def setUp(self):
self.attendance_event = G(
AttendanceEvent,
event=self.event,
- unnatend_deadline=timezone.now() + timedelta(days=1),
+ unattend_deadline=timezone.now() + timedelta(days=1),
)
self.user = G(
User,
diff --git a/apps/payment/views.py b/apps/payment/views.py
index 504ee448e..a77e39a47 100644
--- a/apps/payment/views.py
+++ b/apps/payment/views.py
@@ -3,7 +3,7 @@
import logging
import stripe
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from rest_framework import permissions, status, viewsets
from rest_framework.response import Response
from stripe.error import InvalidRequestError, StripeError
diff --git a/apps/photoalbum/tests/apiv1_tests.py b/apps/photoalbum/tests/apiv1_tests.py
index f3092c172..38e664324 100644
--- a/apps/photoalbum/tests/apiv1_tests.py
+++ b/apps/photoalbum/tests/apiv1_tests.py
@@ -9,9 +9,12 @@
from rest_framework import status
from apps.authentication.models import OnlineUser as User
+from apps.gallery.util import create_responsive_image_from_file
from apps.online_oidc_provider.test import OIDCTestCase
from apps.photoalbum.models import Album, Photo, UserTag
+SAMPLE_IMAGE_PATH = f"{settings.PROJECT_ROOT_DIRECTORY}/files/static/img/splash_bg.jpg"
+
def add_content_type_permission_to_group(group: Group, model):
content_type = ContentType.objects.get_for_model(model)
@@ -113,6 +116,17 @@ def test_permitted_user_can_delete_albums(self):
class PhotoTestCase(OIDCTestCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.image_file = create_responsive_image_from_file(
+ file=open(SAMPLE_IMAGE_PATH, "rb"),
+ name="TEST",
+ description="Description of file",
+ photographer="Test Testesem",
+ preset="photoalbum",
+ )
+
def setUp(self):
self.now = timezone.now()
self.past = self.now - timezone.timedelta(days=1)
@@ -124,8 +138,10 @@ def setUp(self):
self.album: Album = G(Album, published_date=self.past)
self.public_album: Album = G(Album, published_date=self.past, public=True)
- self.photo: Photo = G(Photo, album=self.album)
- self.public_photo: Photo = G(Photo, album=self.public_album)
+ self.photo: Photo = G(Photo, album=self.album, image=self.image_file)
+ self.public_photo: Photo = G(
+ Photo, album=self.public_album, image=self.image_file
+ )
@staticmethod
def get_list_url():
@@ -178,7 +194,7 @@ def test_authenticated_user_can_see_public_and_private_albums(self):
def test_only_permitted_user_can_see_unpublished_photos(self):
unpublished_album = G(Album, published_date=self.future)
- unpublished_photo = G(Photo, album=unpublished_album)
+ unpublished_photo = G(Photo, album=unpublished_album, image=self.image_file)
response = self.client.get(
self.get_detail_url(unpublished_photo), **self.headers
@@ -237,7 +253,7 @@ def test_user_cannot_upload_wrong_image_format(self):
)
self.assertIn(
- "Filendelsen 'gif' er ikke tillatt.", response.json().get("raw_image")[0]
+ 'Filendelsen "gif" er ikke tillatt.', response.json().get("raw_image")[0]
)
self.assertEqual(response.status_code, status.HTTP_400_BAD_REQUEST)
@@ -261,6 +277,17 @@ def test_permitted_user_can_delete_photos(self):
class UserTagsTestCase(OIDCTestCase):
+ @classmethod
+ def setUpClass(cls):
+ super().setUpClass()
+ cls.image_file = create_responsive_image_from_file(
+ file=open(SAMPLE_IMAGE_PATH, "rb"),
+ name="TEST",
+ description="Description of file",
+ photographer="Test Testesem",
+ preset="photoalbum",
+ )
+
def setUp(self):
self.now = timezone.now()
self.past = self.now - timezone.timedelta(days=1)
@@ -272,8 +299,10 @@ def setUp(self):
self.album: Album = G(Album, published_date=self.past)
self.public_album: Album = G(Album, published_date=self.past, public=True)
- self.photo: Photo = G(Photo, album=self.album)
- self.public_photo: Photo = G(Photo, album=self.public_album)
+ self.photo: Photo = G(Photo, album=self.album, image=self.image_file)
+ self.public_photo: Photo = G(
+ Photo, album=self.public_album, image=self.image_file
+ )
self.tag: UserTag = G(UserTag, photo=self.photo)
self.public_tag: UserTag = G(UserTag, photo=self.public_photo)
@@ -311,7 +340,7 @@ def test_authenticated_user_can_see_public_and_private_tags(self):
def test_only_permitted_user_can_see_unpublished_tags(self):
unpublished_album = G(Album, published_date=self.future)
- unpublished_photo = G(Photo, album=unpublished_album)
+ unpublished_photo = G(Photo, album=unpublished_album, image=self.image_file)
unpublished_tag = G(UserTag, photo=unpublished_photo)
response = self.client.get(self.get_detail_url(unpublished_tag), **self.headers)
diff --git a/apps/posters/admin.py b/apps/posters/admin.py
index ee1a780a3..9e65baf30 100644
--- a/apps/posters/admin.py
+++ b/apps/posters/admin.py
@@ -1,5 +1,5 @@
from django.contrib import admin
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from reversion.admin import VersionAdmin
from .models import Poster
diff --git a/apps/posters/dashboard/views.py b/apps/posters/dashboard/views.py
index 729b1fbfb..09e96d248 100644
--- a/apps/posters/dashboard/views.py
+++ b/apps/posters/dashboard/views.py
@@ -11,7 +11,7 @@
redirect,
render,
)
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views.decorators.csrf import ensure_csrf_cookie
from guardian.decorators import permission_required
diff --git a/apps/posters/models.py b/apps/posters/models.py
index 927aa01c2..e7def7bf4 100644
--- a/apps/posters/models.py
+++ b/apps/posters/models.py
@@ -4,7 +4,7 @@
from django.contrib.auth.models import Group
from django.db import models
from django.urls import reverse
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.events.models import Event
diff --git a/apps/profiles/forms.py b/apps/profiles/forms.py
index 9ae7b6cb4..fee5cc392 100644
--- a/apps/profiles/forms.py
+++ b/apps/profiles/forms.py
@@ -3,7 +3,7 @@
from django import forms
from django.contrib import auth
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from apps.authentication.models import OnlineUser, Position
from apps.profiles.models import Privacy
diff --git a/apps/profiles/models.py b/apps/profiles/models.py
index eb63b5e0a..be2ad3379 100644
--- a/apps/profiles/models.py
+++ b/apps/profiles/models.py
@@ -2,7 +2,7 @@
from django.conf import settings
from django.db import models
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
User = settings.AUTH_USER_MODEL
diff --git a/apps/profiles/views.py b/apps/profiles/views.py
index a7cdd7472..0012d9959 100644
--- a/apps/profiles/views.py
+++ b/apps/profiles/views.py
@@ -16,7 +16,7 @@
from django.http import Http404, HttpResponse, JsonResponse
from django.shortcuts import get_object_or_404, redirect, render
from django.utils import timezone
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from django.views import View
from django_filters.rest_framework import DjangoFilterBackend
from googleapiclient.errors import HttpError
diff --git a/apps/sso/models.py b/apps/sso/models.py
index 959751d53..886861d84 100644
--- a/apps/sso/models.py
+++ b/apps/sso/models.py
@@ -3,7 +3,7 @@
# Created by 'myth' on 6/25/15
from django.db.models import TextField
-from django.utils.translation import ugettext as _
+from django.utils.translation import gettext as _
from oauth2_provider.models import AbstractApplication
diff --git a/apps/webshop/serializers.py b/apps/webshop/serializers.py
index 143e2087c..43ce20ca4 100644
--- a/apps/webshop/serializers.py
+++ b/apps/webshop/serializers.py
@@ -63,20 +63,9 @@ class CurrentOrderLineDefault(serializers.CurrentUserDefault):
Gets the currently active order_line for the logged in user
"""
- def __init__(self, *args, **kwargs):
- self.order_line = None
- super().__init__(*args, **kwargs)
-
- def set_context(self, serializer_field):
- # Call set_context to set the user in the context of this object
- super().set_context(serializer_field)
- self.order_line = self.get_or_create_order_line()
-
- def get_or_create_order_line(self) -> OrderLine:
- return OrderLine.get_current_order_line_for_user(self.user)
-
- def __call__(self):
- return self.order_line
+ def __call__(self, serializer_field):
+ user = super().__call__(serializer_field)
+ return OrderLine.get_current_order_line_for_user(user)
class OrderCreateSerializer(serializers.ModelSerializer):
diff --git a/onlineweb4/settings/django.py b/onlineweb4/settings/django.py
index 6c5f98b81..691ef37ee 100644
--- a/onlineweb4/settings/django.py
+++ b/onlineweb4/settings/django.py
@@ -53,7 +53,7 @@
# http://www.i18nguy.com/unicode/language-identifiers.html
LANGUAGE_CODE = "nb"
-LANGUAGES = (("nb", "Norwegian"), ("en_US", "English"))
+LANGUAGES = (("nb", "Norwegian"), ("en-US", "English"))
LOCALE_PATHS = [os.path.join(PROJECT_ROOT_DIRECTORY, "locale")]
SITE_ID = 1
diff --git a/requirements.txt b/requirements.txt
index b34e256fb..b69f390a2 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -1,6 +1,6 @@
-Django==2.2.11
+Django==3.0.4
Pillow==7.0.0 # PIL fork (Python Imaging Library)
-djangorestframework==3.9.4 # API v1
+djangorestframework==3.11.0 # API v1
django-filter==2.2.0 # Filtering for DRF
# python-memcached==1.57 # Memcache. Used by Mailinglists to fetch from Sympa.
# Upstream is missing Python 3 patches
@@ -15,17 +15,19 @@ redis==3.3.11 # Broker for celery
PyMuPDF==1.16.5
# third party deps
-django-filebrowser==3.11.1 # File uploading
+# django-filebrowser==3.12.1 # File uploading
+git+https://github.com/sehmaschine/django-filebrowser.git@4c1a86d67cd7424df57b0e6880152b309823f009#egg=django-filebrowser==3.13.1
git+https://github.com/dotKom/django-chunks.git@e6bf109d4fd286964024c140ac1b8f3d86713540#egg=django-chunks==0.4
-django-crispy-forms==1.8.0 # nice forms
-django-extensions==2.2.3 # nice extra commands for debugging, etc
-django-dynamic-fixture==2.0.0 # Dynamic fixtures for models
-django-recaptcha==2.0.5 # Google ReCaptcha
+django-crispy-forms==1.9.0 # nice forms
+django-extensions==2.2.8 # nice extra commands for debugging, etc
+django-dynamic-fixture==3.1.0 # Dynamic fixtures for models
+django-recaptcha==2.0.6 # Google ReCaptcha
django-oauth-toolkit==1.2.0 # OAuth2 authentication support
-django-watson==1.5.2 # Indexed model search lib
-django-reversion==3.0.4 # Model version history with middleware hooks to all post_save signals
-django-guardian==2.1.0 # Per Object permissions framework
-django-taggit==1.1.0 # Generic multi-model tagging library
+# django-watson==1.5.4 # Indexed model search lib
+git+https://github.com/henrikhorluck/django-watson.git@24c69ff57cc4b840f129f579761b0ac41044e26a#egg=django-watson==1.5.5
+django-reversion==3.0.7 # Model version history with middleware hooks to all post_save signals
+django-guardian==2.2.0 # Per Object permissions framework
+django-taggit==1.2.0 # Generic multi-model tagging library
django-taggit-serializer==0.1.7 # REST Framework serializers for Django-taggit
APScheduler==3.6.1 # Scheduler
git+https://github.com/dotkom/redwine.git@v1.3.1#egg=redwine==1.3.1
@@ -33,7 +35,7 @@ reportlab==3.5.28
pdfdocument==3.3
Unidecode==1.1.1 # Translates every unicode symbol to the closest ascii. online_mail_usernames
django-markdown-deux==1.0.5
-django-cors-headers==3.1.1 # Enable CORS for Nibble
+django-cors-headers==3.2.1 # Enable CORS for Nibble
git+https://github.com/oleast/django-datetime-widget.git@95a5ba4738853d1ed4081e1e33e1600cba984aad#egg=django-datetime-widget==0.9.4
django-webpack-loader==0.6.0 # Integration with webpack
dj-database-url==0.5.0 # Allows to configure databases using URLs
@@ -49,10 +51,10 @@ coreapi==2.3.3 # API documentation
requests[security]==2.22.0
# Wiki
-wiki==0.4.5
+wiki==0.6b1
# Django 1.9 support
-sorl-thumbnail>12.2
+sorl-thumbnail==12.6.2
django-appconf>=1.0.3
# non-pip