From 1549d85377510e1f3026dd31f1c1405fb8a44be3 Mon Sep 17 00:00:00 2001 From: Jakub K Date: Fri, 1 Mar 2024 14:39:49 +0100 Subject: [PATCH] zmiana w nazwach w modelach na snake_case (ujednolicenie) --- jobposting/models.py | 4 ++-- jobposting/views.py | 45 ++++++++++---------------------------------- 2 files changed, 12 insertions(+), 37 deletions(-) diff --git a/jobposting/models.py b/jobposting/models.py index ed2c74b..554257f 100644 --- a/jobposting/models.py +++ b/jobposting/models.py @@ -41,8 +41,8 @@ class JobListing(models.Model): expiration_date = models.DateTimeField(null=True, blank=True) image = models.CharField(max_length=255, null=True, blank=True) experience_level = models.CharField(max_length=255, null=True, blank=True) - employmentType = models.CharField(max_length=255, null=True, blank=True) - workFromHome = models.CharField(max_length=255) + employment_type = models.CharField(max_length=255, null=True, blank=True) + work_from_home = models.CharField(max_length=255) updated_at = models.DateTimeField(auto_now=True) # skillLevels = models.ManyToManyField('SkillLevels', blank=True) anonymous_user_data = models.ForeignKey(AnonymousUserData, diff --git a/jobposting/views.py b/jobposting/views.py index cf0518b..112b199 100644 --- a/jobposting/views.py +++ b/jobposting/views.py @@ -25,6 +25,8 @@ class MyUserViewSet(viewsets.ModelViewSet): queryset = MyUser.objects.all() serializer_class = MyUserSerializer required_scope = ['main'] + authentication_classes = [] ### test only - to be changed + permission_classes = [] ### # # permission_classes = [permissions.IsAuthenticated] class JobListingViewSet(viewsets.ModelViewSet): @@ -33,7 +35,8 @@ class JobListingViewSet(viewsets.ModelViewSet): queryset = JobListing.objects.all() serializer_class = JobListingSerializer required_scope = ['main'] - + authentication_classes = [] + permission_classes = [] # # permission_classes = [permissions.IsAuthenticatedOrReadOnly] def perform_create(self, serializer): @@ -60,6 +63,8 @@ class SkillLevelsViewSet(viewsets.ModelViewSet): queryset = SkillLevels.objects.all() serializer_class = SkillLevelsSerializer required_scope = ['main'] + authentication_classes = [] + permission_classes = [] # # permission_classes = [permissions.IsAuthenticatedOrReadOnly] @@ -81,7 +86,8 @@ class CompanyLogoViewSet(viewsets.ModelViewSet): queryset = CompanyLogo.objects.all() serializer_class = CompanyLogoSerializer required_scope = ['main'] - + authentication_classes = [] + permission_classes = [] class SkillViewset(viewsets.ModelViewSet): # authentication_classes = [OAuth2Authentication, authentication.SessionAuthentication] @@ -89,36 +95,5 @@ class SkillViewset(viewsets.ModelViewSet): queryset = Skill.objects.all() serializer_class = SkillSerializer required_scope = ['main'] - -class GetAuthTokenView(APIView): - # authentication_classes = [] - # permission_classes = [] - def post(self, request): - # print("GET ID") - # client_id = settings.REACT_CLIENT_ID - # client_secret = settings.REACT_CLIENT_SECRET - # print("GET SECRET") - # credential = "{0}:{1}".format(client_id, client_secret) - # credential_b = base64.b64encode(credential.encode("utf-8")).decode("utf-8") - # print(credential_b) - headers = { - "Cache-Control": "no-cache", - "Content-Type": "application/x-www-form-urlencoded" - } - data = { - "grant_type": "client_credentials" - } - print(headers) - print("DATA READY") - proxies = { - "http": "http://tinyproxy-svc:8888",} - try: - response = requests.post('http://izaac.izaac.pl/o/token/', - headers=headers, - data=data, - proxies=proxies) - print(response.json()) - return Response(response.json()) - except: - print("ERROR") - return Response({"error": "error"}, status=status.HTTP_400_BAD_REQUEST) \ No newline at end of file + authentication_classes = [] + permission_classes = [] \ No newline at end of file