Skip to content

Commit

Permalink
erdl#33 edit survey page returns original form to edit
Browse files Browse the repository at this point in the history
  • Loading branch information
jyim3 committed Feb 6, 2018
1 parent 356060a commit 60aaaca
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions ubuntuStation/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,9 @@ def __init__(self, survey_id, question_id, question_position):
self.question_id=question_id
self.question_position=0

def __iter__(self):
return self.question_id

def __repr__(self):
return '<survey question id %r>' %(self.question_id)

Expand Down
4 changes: 2 additions & 2 deletions ubuntuStation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ def callback():
#user.email = email
return redirect(url_for('login'))
user.name = user_data['name']
print(token)
user.tokens = json.dumps(token)
db.session.add(user)
db.session.commit()
Expand Down Expand Up @@ -299,7 +298,6 @@ def edit_question_form(questionid):
form.questiontext.data = question.question_text
form.questiondescription.data = question.question_description
form.questiontype.data = question.question_type
print(form.entries.data)

if request.method == 'POST':
if request.form['action'] == 'Submit':
Expand Down Expand Up @@ -354,10 +352,12 @@ def survey_page(surveyid):
@login_required
def edit_survey_form(surveyid):
survey=SurveyInfo.query.filter_by(survey_info_id=surveyid).one()
surveyq=Question.query.join(SurveyQuestion, Question.question_id == SurveyQuestion.question_id).filter_by(survey_info_id=surveyid).order_by(SurveyQuestion.question_position)
form=SurveyForm(request.form).new()
if request.method == 'GET':
form.surveyname.data = survey.survey_name
form.description.data = survey.description
form.question.data = [q.question_id for q in surveyq]

if request.method == 'POST':
if request.form['action'] == 'Submit':
Expand Down

0 comments on commit 60aaaca

Please sign in to comment.