diff --git a/small_small_hr/forms.py b/small_small_hr/forms.py index 41eaa01..93b6837 100644 --- a/small_small_hr/forms.py +++ b/small_small_hr/forms.py @@ -3,7 +3,7 @@ from django import forms from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # pylint: disable = imported-auth-user from django.db.models import Q from django.utils.translation import ugettext as _ diff --git a/small_small_hr/models.py b/small_small_hr/models.py index 17fbade..3e97c25 100644 --- a/small_small_hr/models.py +++ b/small_small_hr/models.py @@ -507,7 +507,7 @@ def get_days(start: object, end: object): yield local_start.date() + timedelta(days=i) -def get_taken_leave_days( # pylint: disable=bad-continuation +def get_taken_leave_days( staffprofile: object, status: str, leave_type: str, start_year: int, end_year: int ): """ diff --git a/small_small_hr/reviews.py b/small_small_hr/reviews.py index c4e2f70..e83d549 100644 --- a/small_small_hr/reviews.py +++ b/small_small_hr/reviews.py @@ -1,6 +1,6 @@ """Review module for small-small-hr.""" from django.conf import settings -from django.contrib.auth.models import User +from django.contrib.auth.models import User # pylint: disable = imported-auth-user from django.db import models from model_reviews.models import Reviewer diff --git a/small_small_hr/serializers.py b/small_small_hr/serializers.py index 470036d..84b5cc6 100644 --- a/small_small_hr/serializers.py +++ b/small_small_hr/serializers.py @@ -1,7 +1,7 @@ """ Serializers for users app """ -from django.contrib.auth.models import User +from django.contrib.auth.models import User # pylint: disable = imported-auth-user from rest_framework import serializers @@ -18,16 +18,18 @@ class Meta: # pylint: disable=too-few-public-methods """ meta options """ + model = User - fields = ('username', 'first_name', 'last_name', 'email') + fields = ("username", "first_name", "last_name", "email") class StaffProfileSerializer(serializers.ModelSerializer): """ Serializer class for StaffProfile model """ - first_name = serializers.CharField(source='user.first_name') - last_name = serializers.CharField(source='user.last_name') + + first_name = serializers.CharField(source="user.first_name") + last_name = serializers.CharField(source="user.last_name") id_number = serializers.SerializerMethodField() phone = serializers.SerializerMethodField() sex = serializers.SerializerMethodField() @@ -49,123 +51,124 @@ class Meta: # pylint: disable=too-few-public-methods """ class meta options """ + model = StaffProfile fields = [ - 'id', - 'first_name', - 'last_name', - 'created', - 'id_number', - 'phone', - 'sex', - 'modified', - 'role', - 'nhif', - 'emergency_contact_name', - 'nssf', - 'address', - 'birthday', - 'overtime_allowed', - 'leave_days', - 'start_date', - 'sick_days', - 'pin_number', - 'end_date', - 'emergency_contact_number', + "id", + "first_name", + "last_name", + "created", + "id_number", + "phone", + "sex", + "modified", + "role", + "nhif", + "emergency_contact_name", + "nssf", + "address", + "birthday", + "overtime_allowed", + "leave_days", + "start_date", + "sick_days", + "pin_number", + "end_date", + "emergency_contact_number", ] def get_id_number(self, obj): # pylint: disable=no-self-use """ Get id_number """ - return obj.data.get('id_number') + return obj.data.get("id_number") def get_phone(self, obj): # pylint: disable=no-self-use """ Get phone """ - return obj.data.get('phone') + return obj.data.get("phone") def get_sex(self, obj): # pylint: disable=no-self-use """ Get sex """ - return obj.data.get('sex') + return obj.data.get("sex") def get_role(self, obj): # pylint: disable=no-self-use """ Get role """ - return obj.data.get('role') + return obj.data.get("role") def get_nhif(self, obj): # pylint: disable=no-self-use """ Get nhhf """ - return obj.data.get('nhif') + return obj.data.get("nhif") def get_nssf(self, obj): # pylint: disable=no-self-use """ Get nssf """ - return obj.data.get('nssf') + return obj.data.get("nssf") def get_pin_number(self, obj): # pylint: disable=no-self-use """ Get pin_number """ - return obj.data.get('pin_number') + return obj.data.get("pin_number") def get_address(self, obj): # pylint: disable=no-self-use """ Get address """ - return obj.data.get('address') + return obj.data.get("address") def get_birthday(self, obj): # pylint: disable=no-self-use """ Get birthday """ - return obj.data.get('birthday') + return obj.data.get("birthday") def get_leave_days(self, obj): # pylint: disable=no-self-use """ Get leave_days """ - return obj.data.get('leave_days') + return obj.data.get("leave_days") def get_sick_days(self, obj): # pylint: disable=no-self-use """ Get sick_days """ - return obj.data.get('sick_days') + return obj.data.get("sick_days") def get_overtime_allowed(self, obj): # pylint: disable=no-self-use """ Get overtime_allowed """ - return obj.data.get('overtime_allowed') + return obj.data.get("overtime_allowed") def get_start_date(self, obj): # pylint: disable=no-self-use """ Get start_date """ - return obj.data.get('start_date') + return obj.data.get("start_date") def get_end_date(self, obj): # pylint: disable=no-self-use """ Get end_date """ - return obj.data.get('end_date') + return obj.data.get("end_date") def get_emergency_contact_name(self, obj): # pylint: disable=no-self-use """ Get emergency_contact_name """ - return obj.data.get('emergency_contact_name') + return obj.data.get("emergency_contact_name") def get_emergency_contact_number(self, obj): # pylint: disable=no-self-use """ Get emergency_contact_number """ - return obj.data.get('emergency_contact_number') + return obj.data.get("emergency_contact_number")