Skip to content

Commit

Permalink
Revert "feat: add tags to creator registration (#1082)" (#1109)
Browse files Browse the repository at this point in the history
This reverts commit 684dbf7.
  • Loading branch information
NdibeRaymond authored Feb 20, 2024
1 parent 9497588 commit b36bdf1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 14 deletions.
1 change: 0 additions & 1 deletion zubhub_backend/zubhub/creators/adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ def save_user(self, request, user, form, commit=False):
creator.bio = data.get('bio')
creator.location = location
creator.is_active = is_active
creator.tags.set(data.get('creator_tags'))
creator.save()

Setting(creator=creator, subscribe=data.get("subscribe")).save()
Expand Down
14 changes: 2 additions & 12 deletions zubhub_backend/zubhub/creators/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
from django.utils.translation import gettext_lazy as _
import csv
from .admin import badges
from .models import CreatorGroup, Creator, CreatorGroupMembership, Location, PhoneNumber, CreatorTag
from .models import CreatorGroup, Creator, CreatorGroupMembership
from .models import Location, PhoneNumber
from allauth.account.models import EmailAddress
from rest_auth.registration.serializers import RegisterSerializer
from rest_auth.serializers import PasswordResetSerializer
Expand Down Expand Up @@ -198,8 +199,6 @@ class CustomRegisterSerializer(RegisterSerializer):
queryset=Location.objects.all())
bio = serializers.CharField(allow_blank=True, default="", max_length=255)
subscribe = serializers.BooleanField(default=False)
creator_tags = serializers.SlugRelatedField(slug_field='name',
queryset=CreatorTag.objects.all())

def validate_username(self, username):
# Check if the value is a valid email
Expand Down Expand Up @@ -248,22 +247,13 @@ def validate_location(self, location):
raise serializers.ValidationError(_("Location is required"))
return location

def validate_creator_tags(self, creator_tags):
if (len(creator_tags) < 1):
raise serializers.ValidationError(_("Creator tags are required"))
for tag in creator_tags:
if not CreatorTag.objects.filter(name=tag).exists():
raise serializers.ValidationError(_("Invalid creator tag: {}".format(tag)))
return creator_tags

def get_cleaned_data(self):
data_dict = super().get_cleaned_data()
data_dict['phone'] = self.validated_data.get('phone', '')
data_dict['dateOfBirth'] = self.validated_data.get('dateOfBirth', '')
data_dict['location'] = self.validated_data.get('location', '')
data_dict['bio'] = self.validated_data.get('bio', '')
data_dict['subscribe'] = self.validated_data.get('subscribe', '')
data_dict['creator_tags'] = self.validated_data.get('creator_tags', [])

return data_dict

Expand Down
3 changes: 2 additions & 1 deletion zubhub_backend/zubhub/creators/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import csv
from io import StringIO
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from notifications.models import Notification
Expand Down Expand Up @@ -186,7 +188,6 @@ class RegisterCreatorAPIView(RegisterView):
"location": "string",\n
"bio": "",\n
"subscribe": false\n
"creator_tags": "string",\n
}\n
"""

Expand Down

0 comments on commit b36bdf1

Please sign in to comment.