def __init__(self, master, database_model, shared_view, user):
        self.master = master
        self.database_model = database_model
        self.shared_view = shared_view

        self.user_model = UserModel(user, self.database_model)
        self.logged_user_view = LoggedUserView(master, self.shared_view, self.user_model.user)

        self.logged_user_view.btn_change_avatar.config(command=self.change_user_avatar)

        self.logged_user_view.btn_set_to_today.config(command=self.set_to_todays_date)
        self.logged_user_view.btn_prev_date.config(command=self.set_to_prev_day_date)
        self.logged_user_view.btn_next_date.config(command=self.set_to_next_day_date)
        self.logged_user_view.btn_set_date.config(command=self.open_set_date_window)

        self.profile_view = self.logged_user_view.profile_view
        self.meal_plan_view = self.logged_user_view.meal_plan_view
        self.user_products_view = self.logged_user_view.user_products_view
        self.user_dishes_view = self.logged_user_view.user_dishes_view
        self.user_trainings_view = self.logged_user_view.user_trainings_view
        self.raports_view = self.logged_user_view.raports_view

        self.popup_window = None
        self.second_popup_window = None
        self.configure_profile_view_buttons()
        self.configure_meal_plan_view_buttons()
        self.configure_user_products_view_buttons()
        self.configure_user_dishes_view_buttons()
        self.configure_user_trainings_view_buttons()
Exemple #2
0
 def post(self):
     parser.add_argument('username',
                 type=str,
                 required=True,
                 help="username field can not be empty")
     args = parser.parse_args()
     user = UserModel.find_user_by_username(args['username'])
     if user == None:
         new_user = UserModel(**args)
         new_user.save_to_db()
         return {'message': 'User registed successfully'}
     return {'message': 'User already exists'}