def create_count_class(data, github): result = { 'github': github, 'java': data["java"], 'python': data["python"], 'javascript': data["javascript"], 'php': data["php"], 'date': data["date"].strftime("%d-%b-%Y") } serializer = LanguageSerializer(data=result) if serializer.is_valid(): serializer.save() return serializer.data
def get_fosslanguage(request, fossid): try: languages = Language.objects.filter( id__in=TutorialResource.objects.filter( tutorial_detail_id__foss=fossid, status__gte=1).values( 'language_id')) except ObjectDoesNotExist: return HttpResponse(status=404) if request.method == 'GET': serializer = LanguageSerializer(languages, many=True) return JsonResponse(serializer.data, safe=False) get_schooltutorials
def post(self, request): serializer = LanguageSerializer(data=request.data) serializer.is_valid(raise_exception=True) request.user.language = serializer.data['language'] request.user.save() return Response()
def get_all_foss_langauges(request): foss = FossSerializer(FossCategory.objects.all(), many=True).data language = LanguageSerializer(Language.objects.all(), many=True).data context = {'spokentutorials': {'foss': foss, 'language': language}} return Response(context, status=status.HTTP_200_OK)