예제 #1
0
    def retrieve(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        param = request.GET.get('no_lmt', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_no_limit = True

        param = request.GET.get('only_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_residential = True

        param = request.GET.get('only_no_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_non_residential = True

        oid = kwargs['oid']

        conditions = Q(oid=oid, is_hidden_web=False, is_deleted=False)
        if not self.is_no_limit:
            conditions.add(Q(
                Q(management_type__is_own=True)     # 自社物件
                | Q(management_type__is_entrusted=True)     # 専任物件
                | Q(management_type__is_condo_management=True)      # 分譲マンション
            ), Q.AND)

        self.queryset = Building.objects.filter(conditions)
        self.serializer_class = BuildingSerializer
        self.lookup_field = 'oid'

        return super().retrieve(request, args, kwargs)
예제 #2
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        param = request.GET.get('no_lmt', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_no_limit = True

        param = request.GET.get('only_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_residential = True

        param = request.GET.get('only_no_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_non_residential = True

        conditions = Room.get_vacancy_room_condition(
            self.is_no_limit, self.is_only_residential,
            self.is_only_non_residential)

        # 追加条件があればここで追加する。

        self.queryset = Room.objects.filter(conditions).order_by(
            'building__id', 'room_no')
        self.serializer_class = RoomSerializer

        return super().list(request, args, kwargs)
    def retrieve(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        param = request.GET.get('no_lmt', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_no_limit = True

        param = request.GET.get('only_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_residential = True

        param = request.GET.get('only_no_res', None)
        if param:
            if param == '1' or param.lower() == 'true':
                self.is_only_non_residential = True

        oid = kwargs['oid']

        conditions = Q(oid=oid)
        conditions.add(
            Room.get_vacancy_room_condition(
                self.is_no_limit,
                self.is_only_residential,
                self.is_only_non_residential
            ), Q.AND)

        self.queryset = Room.objects.filter(conditions)
        self.serializer_class = RoomSerializer
        self.lookup_field = 'oid'

        return super().retrieve(request, args, kwargs)
예제 #4
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        self.queryset = MonthDay.objects.filter(is_stopped=False).order_by('priority')
        self.serializer_class = MonthDaySerializer

        return super().list(request, args, kwargs)
예제 #5
0
    def retrieve(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        conditions = Q(pk=settings.COMPANY_ID)
        self.queryset = Company.objects.filter(conditions)
        self.serializer_class = CompanySerializer

        return super().retrieve(request, args, kwargs)
예제 #6
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        self.queryset = Pref.objects.filter(
            is_trading_area=True).order_by('priority')
        self.serializer_class = PrefSerializer

        return super().list(request, args, kwargs)
예제 #7
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        self.queryset = DocumentFile.objects.filter(
            is_deleted=False,
            is_publish_web=True,
        ).order_by('priority')
        self.serializer_class = DocumentFileSerializer

        return super().list(request, args, kwargs)
예제 #8
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        city_id = kwargs.get('city_id')

        self.queryset = JuniorHighSchool.objects.filter(
            Q(is_stopped=False, city_junior_high_school_cities__id=city_id)
            | Q(pk=0)).order_by('pref__priority', 'kana')
        self.serializer_class = JuniorHighSchoolSerializer

        return super().list(request, args, kwargs)
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        self.conditions = SearchGarageConditions()
        self.conditions.set_conditions(self.request.query_params)

        self.queryset = SearchedGarage.get_garages(
            conditions=self.conditions, )
        self.serializer_class = SearchedGarageSerializer

        return super().list(request, args, kwargs)
예제 #10
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        landmark_type_id = kwargs.get('landmark_type_id')

        self.queryset = Landmark.objects.filter(
            Q(is_stopped=False, landmark_type_id=landmark_type_id)
            | Q(pk=0)).order_by('landmark_type__priority', 'priority')
        self.serializer_class = LandmarkSerializer

        return super().list(request, args, kwargs)
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        railway_id = kwargs.get('railway_id')

        self.queryset = Station.objects.filter(
            Q(is_stopped=False, railway_id=railway_id) | Q(pk=0)).order_by(
                'railway__priority', 'priority')
        self.serializer_class = StationSerializer

        return super().list(request, args, kwargs)
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        pref_id = kwargs.get('pref_id')

        self.queryset = City.objects.filter(
            Q(is_stopped=False, is_trading_area=True, pref__id=pref_id)
            | Q(pk=0)).order_by('pref__priority', 'priority')
        self.serializer_class = CitySerializer

        return super().list(request, args, kwargs)
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        self.conditions = SearchConditions()
        self.conditions.set_conditions(self.request.query_params)

        self.queryset = SearchedRoom.get_rooms(
            conditions=self.conditions,
            is_residential=False,
        )
        self.serializer_class = SearchedRoomSerializer

        return super().list(request, args, kwargs)
예제 #14
0
    def list(self, request, *args, **kwargs):
        key = kwargs.get('key')
        if not ApiHelper.check_key(key):
            raise Exception

        department_id = kwargs.get('department_id')

        conditions = Q(
            is_stopped=False,
            is_deleted=False,
            is_publish_vacancy=True,
            department__is_stopped=False,
            department__is_deleted=False,
            department__is_publish_vacancy=True,
        )
        if department_id:
            conditions.add(Q(department_id=department_id), Q.AND)

        self.queryset = Staff.objects.filter(conditions).order_by(
            'department__priority', 'priority', 'id')
        self.serializer_class = StaffSerializer

        return super().list(request, args, kwargs)
 def test_check_key(self):
     self.assertTrue(
         ApiHelper.check_key('107a0f11c12c465891ab47b39ea15e30'))
     self.assertFalse(
         ApiHelper.check_key('753099815daf45ab993d0ecbe0e9b05f'))