Skip to content

Commit 9fa2564

Browse files
authored
Merge pull request #38 from cdvx/Update-Delete-Prefer
Update delete prefer
2 parents 5622684 + f318a8e commit 9fa2564

File tree

4 files changed

+264
-128
lines changed

4 files changed

+264
-128
lines changed

app/models.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
class Question:
88
def __init__(self, topic, body):
99
self.id = uuid.uuid4().int
10-
self.topic = topic.strip()
11-
self.body = body.strip()
10+
self.topic = str(topic).strip()
11+
self.body = str(body).strip()
1212

1313
def __repr__(self):
1414
return {
@@ -21,7 +21,7 @@ def __repr__(self):
2121
class Answer:
2222
def __init__(self, body, Qn_Id, pref=False):
2323
self.answerId = uuid.uuid4().int
24-
self.body = body.strip()
24+
self.body = str(body).strip()
2525
self.Qn_Id = Qn_Id
2626
self.prefered = pref
2727

@@ -33,16 +33,16 @@ def __repr__(self):
3333
'prefered': self.prefered
3434
}
3535

36-
def prefer_answer(self, answer):
37-
answer.prefered = True
36+
def prefer_answer(self):
37+
self.prefered = True
3838

3939

4040
class User:
4141
def __init__(self, username, email, password):
4242
self.salt = bcrypt.gensalt()
4343
self.id = uuid.uuid4().int
44-
self.username = username.strip()
45-
self.email = email.strip()
44+
self.username = str(username).strip()
45+
self.email = str(email).strip()
4646
self.password_hash = generate_password_hash(password)
4747

4848
def __repr__(self):

0 commit comments

Comments
 (0)