Exemplo n.º 1
0
    def post(self):
        user = User.get(id=int(get_jwt_identity()))
        if user.account_type != 'admin':
            return {}, 401

        data = parser.parse_args()
        facebook = Info.get(name="facebook")
        twitter = Info.get(name="twitter")
        instagram = Info.get(name="instagram")
        print data

        if data['facebook']:
            facebook.value = data['facebook']
            facebook.save()
        if data['twitter']:
            twitter.value = data['twitter']
            twitter.save()
        if data['instagram']:
            instagram.value = data['instagram']
            instagram.save()

        return {'data': '', 'message': '', 'status': 'OK'}
Exemplo n.º 2
0
    def post(self):
        user = User.get(id=int(get_jwt_identity()))
        if user.account_type != 'admin':
            return {}, 401

        data = parser.parse_args()
        print data
        info = Info.get(name=data['ads-name'])
        if data['file'] == '':
            return {'data': '', 'message': 'No photo found', 'status': 'Error'}
        photo = data['file']
        if photo:
            if info.value:
                remove_file(info.value)
                print 'Updating'
            else:
                print 'Creating'
            info.value = get_date() + '.png'
            photo.save(os.path.join(UPLOAD_FOLDER, info.value))
            info.save()
        return {'data': info.dictionary(), 'status': '', 'message': ''}
Exemplo n.º 3
0
 def get(self):
     ad = Info.get(name="ads-left")
     return {'data': ad.dictionary(), 'status': 'OK', 'message': ''}
Exemplo n.º 4
0
 def get(self):
     user = User.get(id=int(get_jwt_identity()))
     if user.account_type != 'admin':
         return {}, 401
     ads_left = Info.get(name="ads-left")
     return {'status': 'OK', 'message': '', 'data': [ads_left.dictionary()]}