Browse Source

Make avatar optional again, and change depricated calls

master
Joshua Rubingh 5 months ago
parent
commit
895b73ed09
  1. 2
      VRE/VRE/settings.py
  2. 2
      VRE/apps/api/apps.py
  3. 2
      VRE/apps/dropoff/apps.py
  4. 2
      VRE/apps/invitation/apps.py
  5. 2
      VRE/apps/researcher/apps.py
  6. 3
      VRE/apps/researcher/serializers.py
  7. 4
      VRE/apps/researcher/views.py
  8. 2
      VRE/apps/storage/apps.py
  9. 2
      VRE/apps/study/apps.py
  10. 2
      VRE/apps/university/apps.py
  11. 2
      VRE/apps/virtual_machine/apps.py
  12. 2
      VRE/apps/virtual_machine/providers/openstack/apps.py
  13. 2
      VRE/apps/virtual_machine/providers/vrw/apps.py
  14. 2
      VRE/apps/vre_apps/apps.py

2
VRE/VRE/settings.py

@ -16,7 +16,7 @@ from pathlib import Path @@ -16,7 +16,7 @@ from pathlib import Path
import sentry_sdk
from decouple import config, Csv
from dj_database_url import parse as db_url
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from redis import ConnectionPool
from sentry_sdk.integrations.django import DjangoIntegration

2
VRE/apps/api/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from django.conf import settings

2
VRE/apps/dropoff/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class DropoffConfig(AppConfig):

2
VRE/apps/invitation/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class InvitationConfig(AppConfig):

2
VRE/apps/researcher/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class ResearcherConfig(AppConfig):

3
VRE/apps/researcher/serializers.py

@ -54,7 +54,8 @@ class ResearcherSerializer(serializers.ModelSerializer): @@ -54,7 +54,8 @@ class ResearcherSerializer(serializers.ModelSerializer):
instance.user.save()
instance.mobilephone = validated_data.get('mobilephone')
instance.avatar = validated_data.get('avatar')
if (validated_data.get('avatar')):
instance.avatar = validated_data.get('avatar')
instance.idnumber = validated_data.get('idnumber')
instance.save()

4
VRE/apps/researcher/views.py

@ -42,6 +42,10 @@ class Researchers(viewsets.ModelViewSet): @@ -42,6 +42,10 @@ class Researchers(viewsets.ModelViewSet):
def update(self, request, *args, **kwargs):
# Set a 'fake' pk value so we can use the normal serializer update
request.parser_context['kwargs']['pk'] = request.user.researcher.id
if request.data.get('avatar') and (request.data['avatar'].startswith('/media/') or request.data['avatar'].startswith('http://') or request.data['avatar'].startswith('https://')):
# Do not change the existing avatar image.
del(request.data['avatar'])
super().update(request, *args, **kwargs)
# Reload the data from DB
researcher = get_object_or_404(Researcher, pk=request.user.researcher.id)

2
VRE/apps/storage/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class StorageConfig(AppConfig):

2
VRE/apps/study/apps.py

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class StudyConfig(AppConfig):

2
VRE/apps/university/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class UniversityConfig(AppConfig):

2
VRE/apps/virtual_machine/apps.py

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class VirtualMachineConfig(AppConfig):

2
VRE/apps/virtual_machine/providers/openstack/apps.py

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from datetime import timedelta

2
VRE/apps/virtual_machine/providers/vrw/apps.py

@ -1,6 +1,6 @@ @@ -1,6 +1,6 @@
from django.apps import AppConfig
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
from datetime import timedelta

2
VRE/apps/vre_apps/apps.py

@ -1,5 +1,5 @@ @@ -1,5 +1,5 @@
from django.apps import AppConfig
from django.utils.translation import ugettext_lazy as _
from django.utils.translation import gettext_lazy as _
class VRE_AppsConfig(AppConfig):

Loading…
Cancel
Save