diff --git a/api/common/common_views.py b/api/common/common_views.py index 6d3fc49e..c2a84fd1 100644 --- a/api/common/common_views.py +++ b/api/common/common_views.py @@ -245,7 +245,7 @@ def get(self, request): LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value, created_at__date=date) .values(org_title=F("org__title")) .annotate( - learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle") + learning_circle_count=Count("id"), user_count=Count("user_circle_link_user") ) .order_by("org_title") ) @@ -254,7 +254,7 @@ def get(self, request): LearningCircle.objects.filter(org__org_type=OrganizationType.COLLEGE.value) .values(org_title=F("org__title")) .annotate( - learning_circle_count=Count("id"), user_count=Count("user_circle_link_circle") + learning_circle_count=Count("id"), user_count=Count("user_circle_link_user") ) .order_by("org_title") ) @@ -274,53 +274,6 @@ def get(self, request): ) -class HackathonDataAPI(APIView): - - def get(self, request): - hackathon_data = { - 'hackathons': { - 'Beyond Us': { - "Domain": ["Software", "Design (UI,UX)"], - "total_applicants_registered": 374, - "short_listed_candidates": 231, - "total_teams_shortlisted": {"total": 58, "domains": {"Software": 40, "Design (UI,UX)": 18}}, - "no_of_offer_given": {'count': 1, "status": "Offer Rejected by the candidate"}, - "no_of_placements": {"count": 0, "status": None}, - "attended_people": None, - "hackathon_type": "Online", - "location": "Discord" - }, - 'GTA: CodeStorm': { - "Domain": ["Software", "Design (UI/UX)", "Hardware", "Civil"], - "total_applicants_registered": 451, - "short_listed_candidates": 202, - "total_teams_shortlisted": {"total": 62, - "domains": {"Software": 18, "Design (UI/UX)": 17, "Hardware": 18, - "Civil": 9}}, - "no_of_offer_given": {'count': 15, "status": "5 Rejected by the candidates"}, - "no_of_placements": {'count': 10, "status": "2 Full time positions + 8 full time internships"}, - "attended_people": 168, - "hackathon_type": "Offline", - "location": "Kochi", - }, - 'GTA: SandShores': { - "Domain": ["Web Development", "App Development", "AI/ML", "AR/VR"], - "total_applicants_registered": 1765, - "short_listed_candidates": 120, - "total_teams_shortlisted": {"total": 29, - "domains": {"Web Development": 12, "App Development": 7, "AI/ML": 7, - "AR/VR": 3}}, - "no_of_offer_given": {'count': 0, "status": "In Progress"}, - "no_of_placements": {'count': 0, "status": "In Progress"}, - "attended_people": None, - "hackathon_type": "Offline", - "location": "Thrissur", - }, - } - } - pass - - class LearningCircleEnrollment(APIView): def get(self, request): @@ -364,9 +317,11 @@ def get(self, request): "circle_name": "circle_name", "district": "district", "circle_ig": "circle_ig", "organisation": "organisation", "dwms_id": "dwms_id", "karma_earned": "karma_earned"}, is_pagination=False) - lc_enrollment = LearningCircleEnrollmentSerializer(paginated_queryset, many=True).data + lc_enrollment = LearningCircleEnrollmentSerializer(paginated_queryset.get('queryset'), many=True).data - return CustomResponse(response=lc_enrollment).get_success_response() + return CustomResponse().paginated_response( + data=lc_enrollment, pagination=paginated_queryset.get("pagination") + ) class LearningCircleEnrollmentCSV(APIView): diff --git a/api/dashboard/organisation/urls.py b/api/dashboard/organisation/urls.py index a87d0019..e02e0998 100644 --- a/api/dashboard/organisation/urls.py +++ b/api/dashboard/organisation/urls.py @@ -24,7 +24,6 @@ path('merge_organizations//', organisation_views.OrganizationMergerView.as_view()), path('karma-type/create/', organisation_views.OrganizationKarmaTypeGetPostPatchDeleteAPI.as_view()), path('karma-log/create/', organisation_views.OrganizationKarmaLogGetPostPatchDeleteAPI.as_view()), - path('base-template/', organisation_views.OrganisationBaseTemplateAPI.as_view()), path('import/', organisation_views.OrganisationImportAPI.as_view()), ] diff --git a/api/dashboard/task/urls.py b/api/dashboard/task/urls.py index dab24220..46544114 100644 --- a/api/dashboard/task/urls.py +++ b/api/dashboard/task/urls.py @@ -5,7 +5,7 @@ urlpatterns = [ #task_type path('list-task-type/', dash_task_view.TaskTypeCrudAPI.as_view()), # get tasktype,create tasktype - path('list-task-type/', dash_task_view.TaskTypeCrudAPI.as_view()), # delete,edit + path('task-type//', dash_task_view.TaskTypeCrudAPI.as_view()), # delete,edit path('channel/', dash_task_view.ChannelDropdownAPI.as_view()), path('ig/', dash_task_view.IGDropdownAPI.as_view()), diff --git a/api/dashboard/user/dash_user_serializer.py b/api/dashboard/user/dash_user_serializer.py index 033638e9..b99137e4 100644 --- a/api/dashboard/user/dash_user_serializer.py +++ b/api/dashboard/user/dash_user_serializer.py @@ -99,7 +99,7 @@ class UserDetailsSerializer(serializers.ModelSerializer): organizations = serializers.SerializerMethodField(read_only=True) interest_groups = serializers.SerializerMethodField(read_only=True) role = serializers.SerializerMethodField(read_only=True) - district = serializers.CharField(source="district.name") + district = serializers.CharField(source="district.name", allow_null=True) class Meta: model = User diff --git a/api/register/register_views.py b/api/register/register_views.py index f3f40c87..cb8cec49 100644 --- a/api/register/register_views.py +++ b/api/register/register_views.py @@ -184,6 +184,24 @@ def post(self, request): ).get_success_response() +class SchoolAPI(APIView): + def post(self, request): + org_queryset = Organization.objects.filter( + Q(org_type=OrganizationType.SCHOOL.value), + Q(district_id=request.data.get("district")), + ) + + college_serializer_data = serializers.OrgSerializer( + org_queryset, many=True + ).data + + return CustomResponse( + response={ + "schools": college_serializer_data, + } + ).get_success_response() + + class CommunityAPI(APIView): def get(self, request): community_queryset = Organization.objects.filter( diff --git a/api/register/urls.py b/api/register/urls.py index 282f6290..039481f6 100644 --- a/api/register/urls.py +++ b/api/register/urls.py @@ -17,6 +17,7 @@ path("college/list/", register_views.CollegeAPI.as_view()), path("company/list/", register_views.CompanyAPI.as_view()), path("community/list/", register_views.CommunityAPI.as_view()), + path("schools/list/", register_views.SchoolAPI.as_view()), path("area-of-interest/list/", register_views.AreaOfInterestAPI.as_view()), path("lc/user-validation/", register_views.LearningCircleUserViewAPI.as_view()), path('email-verification/', register_views.UserEmailVerificationAPI.as_view()),