Пример #1
0
 def get(self):
     result = self.guest_model.get_guests(session['id'])
     if result:
         users = UserData()
         result = users.get_users(result)
         return {'guests': result}
     else:
         return {}, 204
Пример #2
0
 def root(message=None, message_type=None):
     if 'id' in session:
         searchl = SearchUser()
         userdb = UserData()
         user = userdb.get_data(session['id'])
         users = searchl.preferences(user)
         users = userdb.get_users(users)
         return render_template('search.html', users=users, d_message='5')
     elif message is not None:
         return render_template('start_page.html',
                                message=message,
                                message_type=message_type)
     else:
         return render_template('start_page.html')
Пример #3
0
 def search_post():
     form = Search()
     if form.validate():
         searchl = SearchUser()
         print(
             searchl.search(tuple(form.tags.data),
                            None,
                            form.min_age.data,
                            form.max_age.data,
                            sex_pref='Male'))
         users = searchl.search(
             form.tags.data,
             (form.country.data, form.region.data, form.city.data),
             form.min_age.data, form.max_age.data, form.min_rating.data,
             form.max_rating.data, form.sex_pref.data)
         users = UserData().get_users(users, form.sort_age.data,
                                      form.sort_rating.data)
         print(users)
         return render_template('search.html',
                                users=users,
                                search={
                                    'age': form.sort_age.data,
                                    'rating': form.sort_rating.data
                                })
     else:
         return render_template('search.html',
                                form=form,
                                name=session['username'])
Пример #4
0
 def main_get():
     if 'id' in session:
         upload_form = UploadImage()
         user = UserData().get_data(session['id'])
         return render_template('profile_page.html',
                                user=user,
                                form=upload_form)
     else:
         return redirect(url_for('root'))
Пример #5
0
class LikeUncheckApi(Resource):
    def __init__(self):
        self.like_model = Like()
        self.users_model = UserData()

    def get(self):
        usersid = self.like_model.uncheck_like(session['id'])
        if usersid:
            data = self.users_model.get_users(usersid)
            return {'likes': data}, 200
        else:
            return {}, 204

    def post(self):
        self.like_model.check_like(session['id'])
        return {}, 200
Пример #6
0
 def main_post():
     if 'id' in session:
         upload_form = UploadImage()
         exchange = ImageExchange()
         if request.files:
             f = request.files['img']
             f.save(secure_filename(f.filename))
             url = f.filename
             exchange.upload_img(url, session['id'])
             return secure_filename(request.files['img'].filename)
         else:
             return render_template('profile_page.html',
                                    form=upload_form,
                                    user=UserData().get_data(session['id']),
                                    name=session['username'])
     else:
         return redirect(url_for('root'))
Пример #7
0
 def user(uid: int):
     user = UserData().get_data(uid)
     GuestsCheck().add_guest(session['id'], uid)
     return render_template('profile_page.html', user=user, like='like')
Пример #8
0
 def __init__(self):
     self.like_model = Like()
     self.users_model = UserData()