예제 #1
0
def user_edit():
    if 'username' not in session:
        return redirect('/ban')
    form = EditForm()
    if form.validate_on_submit():
        url = form.photo.data
        status = form.status.data
        nm = UsersModel(users_db.get_connection())
        nm.update_status(status, session['user_id'])
        nm.update_photo(url, session['user_id'])
        my_page = '/' + str(session['user_id'])
        return redirect(my_page)
    return render_template('edit.html',
                           title='Редактирование',
                           form=form,
                           my_page=False,
                           cur_user_id=session['user_id'],
                           username=session['username'])
예제 #2
0
 def __edit_form(self, widget, selection):
     """
     Edit the selected form.
     """
     model, iter_ = selection.get_selected()
     if iter_:
         citation = model.get_value(iter_, 0)
         try:
             EditForm(self.gui.dbstate, self.gui.uistate, [], citation,
                      self.update)
         except WindowActiveError:
             pass
예제 #3
0
 def __new_form(self, widget):
     """
     Create a new form and invoke the editor.
     """
     sel = SelectForm(self.dbstate, self.uistate, [])
     source_handle = sel.run()
     if source_handle:
         citation = Citation()
         citation.set_reference_handle(source_handle)
         try:
             EditForm(self.gui.dbstate, self.gui.uistate, [], citation,
                      self.update)
         except WindowActiveError:
             pass