Skip to content

Commit

Permalink
Suggested Changes Done
Browse files Browse the repository at this point in the history
  • Loading branch information
Apalakimmortal committed Oct 28, 2024
1 parent edadba0 commit acbf399
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
16 changes: 7 additions & 9 deletions backend/djangoindia/api/serializers/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,19 @@ class EventRegistrationSerializer(serializers.Serializer):
other_links = serializers.URLField(required=False, allow_blank=True)
rsvp = serializers.BooleanField(default=False)
include_in_attendee_list = serializers.BooleanField(default=False)
first_time_attendee = serializers.BooleanField(default= True)
attendee_type = serializers.ChoiceField(choices=EventRegistration.AttendeeType)

def create(self, validated_data):
return EventRegistration.objects.create(**validated_data)

class EventAttendeeSerializer(serializers.Serializer):
full_name = serializers.SerializerMethodField()
professional_status = serializers.ChoiceField(choices=EventRegistration.ProfessionalStatus)
organization = serializers.CharField(max_length=100,required=False, allow_blank=True)
linkedin = serializers.URLField()
github = serializers.URLField(required=False, allow_blank=True)
twitter = serializers.URLField(required=False, allow_blank=True)
first_time_attendee = serializers.BooleanField(default= True)
attendee_type = serializers.ChoiceField(choices=EventRegistration.AttendeeType)

class Meta:
model = EventRegistration
fields = [
'full_name', 'professional_status', 'organization',
'linkedin', 'github', 'twitter', 'first_time_attendee',
'attendee_type',
]
def get_full_name(self, obj):
return f"{obj.first_name} {obj.last_name}"
6 changes: 4 additions & 2 deletions backend/djangoindia/api/views/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
EventRegistrationSerializer,
EventSerializer,
EventLiteSerializer,
EventAttendeeSerializer
)
from djangoindia.bg_tasks.event_registration import registration_confirmation_email_task
from djangoindia.db.models import Event, EventRegistration,Volunteer, Sponsorship,CommunityPartner
Expand All @@ -16,13 +17,14 @@

# Create your views here.
class EventAttendeeViewSet(mixins.ListModelMixin, viewsets.GenericViewSet):
serializer_class = EventRegistrationSerializer
serializer_class = EventAttendeeSerializer

def get_queryset(self):
event_slug = self.kwargs.get('event_slug')
event = get_object_or_404(Event, slug=event_slug)
queryset = EventRegistration.objects.filter(
event__slug=event_slug
event__slug=event_slug,
include_in_attendee_list=True
).select_related('event').order_by('first_name', 'last_name')
return queryset, event

Expand Down

0 comments on commit acbf399

Please sign in to comment.