-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
review exercise #61
base: master
Are you sure you want to change the base?
review exercise #61
Conversation
# user = auth.authenticate(username=username,password=password) | ||
# auth.login(self.request, user) | ||
# except: | ||
# raise ValidateError("System error!") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
注释掉的代码应该删除
#获取活动列表 | ||
def get(self): | ||
# if self.request.user.is_authenticated(): | ||
activity_List = [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
为什么要把所有检查登陆的操作注释掉。。。。。。这应该是必须的
activity.save() | ||
else: | ||
raise ValidateError("Activity is already deleted!") | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice code here......我们小组貌似忘了处理 活动不存在和已经被删除的情况。。。
if (year < 1911 or year > datetime.datetime.now().year): | ||
raise ValidateError('无效学号!') | ||
else: | ||
raise ValidateError('无效学号!') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
学号验证应该有更好的方式。
|
||
# #修改活动详情 | ||
def post(self): | ||
# if self.request.user.is_authenticated(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
应该首先判断活动是否结束
f.write(index) | ||
f.close() | ||
return SITE_DOMAIN + '/img/activityImage/' + image.name | ||
except: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不应该使用图片名作为标识,可能出现重名覆盖导致前面的图片丢失。应该专门生成一个id
No description provided.