コード例 #1
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def check_entry_duplicate(self):
     command = "SELECT title FROM entries where email = %s"
     c.execute(command,(self.email,))
     value = c.fetchall()
     return value
コード例 #2
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def get_entry_by_id(self,entry_id):
     command = "SELECT * FROM entries WHERE entry_id = %s and email = %s "
     c.execute(command,(entry_id,self.email))
     value = c.fetchone()
     return value
コード例 #3
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def modify_entry(self, entry_id):
     command = "UPDATE entries SET title = %s , content = %s WHERE entry_id = %s  "
     c.execute(command, (self.title, self.content, entry_id))
コード例 #4
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def get_all_entries(self):
     command = "SELECT * FROM entries WHERE email = %s "
     c.execute(command,(self.email,))
     value=c.fetchall()
     return value
コード例 #5
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def add_entry(self):
     command = '''INSERT INTO entries (email,title, date, content)
     VALUES (%s, %s, %s, %s)
     '''
     c.execute(command, (self.email,self.title, self.date, self.content))
コード例 #6
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def login_user(self):
     command ="SELECT email FROM users WHERE email = %s AND password=%s"
     c.execute(command,(self.email, self.password))
     value=c.fetchone()
     return value
コード例 #7
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def check_duplicate(self):
     command = "SELECT email FROM users where email = %s"
     c.execute(command,(self.email,))
     value = c.fetchone()
     return value
コード例 #8
0
ファイル: models.py プロジェクト: nakiwuge/diary
 def add_user(self):
     command = '''INSERT INTO users (email, username, password)
     VALUES (%s, %s, %s)'''
     c.execute(command, (self.email, self.username, self.password))