Exemplo n.º 1
0
    def post(self, request):
        skill = request.data.get("skill")
        serializer = SkillSerializer(data=skill)

        if serializer.is_valid(raise_exception=True):
            skill_saved = serializer.save()

        return Response({"Success": "Skill '{}' created succesfully.".format(skill_saved.title)})
Exemplo n.º 2
0
 def get(self, request):
     skills = Skill.objects.all()
     serializer = SkillSerializer(skills, many=True)
     return Response({"Skills": serializer.data})