Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .idea/commandlineblog.iml

This file was deleted.

4 changes: 0 additions & 4 deletions .idea/encodings.xml

This file was deleted.

7 changes: 0 additions & 7 deletions .idea/misc.xml

This file was deleted.

8 changes: 0 additions & 8 deletions .idea/modules.xml

This file was deleted.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

254 changes: 0 additions & 254 deletions .idea/workspace.xml

This file was deleted.

13 changes: 0 additions & 13 deletions app/__init__.py

This file was deleted.

Empty file removed app/api/__init__.py
Empty file.
10 changes: 0 additions & 10 deletions app/api/v1/__init__.py

This file was deleted.

Empty file removed app/api/v1/comments/__init__.py
Empty file.
Empty file removed app/api/v1/comments/models.py
Empty file.
Empty file removed app/api/v1/comments/views.py
Empty file.
Empty file removed app/api/v1/users/__init__.py
Empty file.
Empty file removed app/api/v1/users/models.py
Empty file.
Empty file removed app/api/v1/users/views.py
Empty file.
59 changes: 59 additions & 0 deletions commandblog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import datetime

comments = []
users = [
{
"name": "kenn",
"password": "1234",
"role": "admin",
"lastLoginAt": ""

},
{
"name": "issa",
"password": "1234",
"role": "moderator",
"lastLoginAt": ""
},
{
"name": "eric",
"password": "1234",
"role": "normal",
"lastLoginAt": ""
},
{
"name": "steve",
"password": "1234",
"role": "normal"
}
]

def login():
username = input("please input username: ")

for user in users:
if user['name'] == username:
# return user['password']
password = input("please input password: ")
if user['password'] != password:
print('Wrong password')
user["lastLoginAt"] = datetime.datetime.now()

if user['role'] == "normal":
userinput = input("1. create comment \n 2.Edit comment \n 3. logout ")

if userinput == str("1"):
comment = input("Enter your comment:")

data = {'comment_id': len(comments) +1,
'comment': comment,
'timestamp': datetime.datetime.now() ,
'created_by': username
}
comments.append(data)
return comments




print(login())