Пример #1
0
    def post(self, request, *args, **kwargs):
        super(UserAction, self).post(request, *args, **kwargs)

        email = self.json_request.get('email')
        action = self.json_request.get('action')
        timestamp = self.json_request.get('timestamp')

        if email is not None:
            try:
                User.objects.get(email=email)
            except User.DoesNotExist:
                return respond_with_json({
                    'status':
                    'ERROR',
                    'message':
                    'User does not exist on our system'
                })
        else:
            return respond_with_json({
                'status':
                'ERROR',
                'message':
                'Could not read email address from request'
            })

        return respond_with_json({'status': 'SUCCESS'})
Пример #2
0
    def post(self, request, *args, **kwargs):
        super(EmailSFTPFileUploaded, self).post(request, *args, **kwargs)

        file_path = self.json_request.get('file_path')

        if file_path is not None:
            automatic_emails.email_sftp_file_uploaded.delay(file_path)
        else:
            return respond_with_json({'status': 'ERROR',
                                      'message': 'Could not read file path from request'})

        return respond_with_json({'status': 'SUCCESS'})
Пример #3
0
    def post(self, request, *args, **kwargs):
        super(EmailSFTPAccountCreated, self).post(request, *args, **kwargs)

        username = self.json_request.get('username')
        password = self.json_request.get('password')

        if username is not None and password is not None:
            automatic_emails.email_sftp_account_created.delay(username, password)
        else:
            return respond_with_json({'status': 'ERROR',
                                      'message': 'Could not read username or password from request'})

        return respond_with_json({'status': 'SUCCESS'})
Пример #4
0
    def post(self, request, *args, **kwargs):
        super(ApproveEvaluationRequest, self).post(request, *args, **kwargs)

        email = self.json_request.get('email')

        if email is not None:
            try:
                User.objects.get(email=email)
            except User.DoesNotExist:
                return respond_with_json({'status': 'ERROR',
                                          'message': 'User does not exist on our system'})
        else:
            return respond_with_json({'status': 'ERROR',
                                      'message': 'Could not read email address from request'})

        return respond_with_json({'status': 'SUCCESS'})
Пример #5
0
    def post(self, request, *args, **kwargs):
        super(EmailSFTPFileUploaded, self).post(request, *args, **kwargs)

        file_path = self.json_request.get('file_path')

        if file_path is not None:
            automatic_emails.email_sftp_file_uploaded.delay(file_path)
        else:
            return respond_with_json({
                'status':
                'ERROR',
                'message':
                'Could not read file path from request'
            })

        return respond_with_json({'status': 'SUCCESS'})
Пример #6
0
    def post(self, request, *args, **kwargs):
        super(EmailSFTPAccountCreated, self).post(request, *args, **kwargs)

        username = self.json_request.get('username')
        password = self.json_request.get('password')

        if username is not None and password is not None:
            automatic_emails.email_sftp_account_created.delay(
                username, password)
        else:
            return respond_with_json({
                'status':
                'ERROR',
                'message':
                'Could not read username or password from request'
            })

        return respond_with_json({'status': 'SUCCESS'})
Пример #7
0
    def get(self, request, *args, **kwargs):

        content_type = kwargs['content_type']

        if content_type == 'event':
            content_object = get_object_or_404(skyhigh_models.Event, pk=kwargs['pk'])
        elif content_type == 'media_coverage':
            content_object = get_object_or_404(skyhigh_models.MediaCoverage, pk=kwargs['pk'])

        return respond_with_json({'url': content_object.get_120x120_url()})
Пример #8
0
    def get(self, request, *args, **kwargs):

        content_type = kwargs['content_type']

        if content_type == 'event':
            content_object = get_object_or_404(skyhigh_models.Event,
                                               pk=kwargs['pk'])
        elif content_type == 'media_coverage':
            content_object = get_object_or_404(skyhigh_models.MediaCoverage,
                                               pk=kwargs['pk'])

        return respond_with_json({'url': content_object.get_120x120_url()})
Пример #9
0
    def get(self, request, *args, **kwargs):
        action = kwargs['action']
        user_id = kwargs['user_id']

        partnership = skyhigh_models.Partnership.objects.get(user__pk=user_id)

        if action == 'approve':
            partnership.status = constants.PARTNERSHIP_REQUEST_STATUS_APPROVED

        elif action == 'decline':
            partnership.status = constants.PARTNERSHIP_REQUEST_STATUS_DECLINED
            
        partnership.modified_by = request.user

        partnership.save()

        if request.is_ajax():
            return respond_with_json({'status': 'success'})

        return HttpResponseRedirect(request.META['HTTP_REFERER'])
Пример #10
0
    def get(self, request, *args, **kwargs):
        action = kwargs['action']
        user_id = kwargs['user_id']

        partnership = skyhigh_models.Partnership.objects.get(user__pk=user_id)

        if action == 'approve':
            partnership.status = constants.PARTNERSHIP_REQUEST_STATUS_APPROVED

        elif action == 'decline':
            partnership.status = constants.PARTNERSHIP_REQUEST_STATUS_DECLINED

        partnership.modified_by = request.user

        partnership.save()

        if request.is_ajax():
            return respond_with_json({'status': 'success'})

        return HttpResponseRedirect(request.META['HTTP_REFERER'])
Пример #11
0
    def get(self, request, *args, **kwargs):
        action = kwargs['action']
        user_id = kwargs['user_id']

        evaluation = skyhigh_models.ProductEvaluation.objects.get(user__pk=user_id)
        
        evaluation.modified_by = request.user

        if action == 'approve':
            evaluation.status = constants.PRODUCT_EVALUATION_STATUS_APPROVED
            evaluation.save()

            api_product.create_evaluation_account(evaluation.user)

        elif action == 'decline':
            evaluation.status = constants.PRODUCT_EVALUATION_STATUS_DECLINED
            evaluation.save()

        if request.is_ajax():
            return respond_with_json({'status': 'success'})

        return HttpResponseRedirect(request.META['HTTP_REFERER'])
Пример #12
0
    def get(self, request, *args, **kwargs):
        action = kwargs['action']
        user_id = kwargs['user_id']

        evaluation = skyhigh_models.ProductEvaluation.objects.get(
            user__pk=user_id)

        evaluation.modified_by = request.user

        if action == 'approve':
            evaluation.status = constants.PRODUCT_EVALUATION_STATUS_APPROVED
            evaluation.save()

            api_product.create_evaluation_account(evaluation.user)

        elif action == 'decline':
            evaluation.status = constants.PRODUCT_EVALUATION_STATUS_DECLINED
            evaluation.save()

        if request.is_ajax():
            return respond_with_json({'status': 'success'})

        return HttpResponseRedirect(request.META['HTTP_REFERER'])
Пример #13
0
 def post(self, request, *args, **kwargs):
     if not self.validate_json(request):
         return respond_with_json({'status': 'ERROR',
                                   'message': 'Could not decode JSON object'})
Пример #14
0
 def post(self, request, *args, **kwargs):
     if not self.validate_json(request):
         return respond_with_json({
             'status': 'ERROR',
             'message': 'Could not decode JSON object'
         })