Open
Conversation
lity98
commented
Nov 16, 2018
| self.check_input('image') | ||
| image = self.input['image'][0] | ||
| try: | ||
| f = open("static/img/activityImage/" + image.name, "wb") |
Author
There was a problem hiding this comment.
如果创建的多个活动的图片有相同的文件名,后面的图片会覆盖之前的图片文件,导致前一个活动图片丢失。
我认为不应该用图片名直接作为服务器保存的文件名,而应该想办法生成一个unique id。
lity98
commented
Nov 16, 2018
| id = self.input['id'] | ||
| try: | ||
| activity = Activity.objects.get(id=id) | ||
| activity.id = self.input['id'] |
lity98
commented
Nov 16, 2018
| activity.total_tickets = self.input['totalTickets'] | ||
| activity.status = self.input['status'] | ||
|
|
||
| activity.save() |
Author
There was a problem hiding this comment.
修改活动详情有很多限制,如活动开始后不能修改抢票时间之类的,这里没有找到相关功能的代码。
lity98
commented
Nov 16, 2018
| activity_ids.append(int(activity_id)) | ||
| acts = Activity.objects.filter( | ||
| id__in=activity_ids, status=Activity.STATUS_PUBLISHED, book_end__gt=timezone.now() | ||
| ).order_by('book_end')[: 5] |
Author
There was a problem hiding this comment.
为啥要order_by book_end,这样可能得到的顺序和抢票菜单里的真实顺序不一样。
lity98
commented
Nov 16, 2018
| raise ValidateError("Activity for this ID does not exit!") | ||
| try: | ||
| T = Ticket.objects.filter(activity=activity, student_id=studentId) | ||
| for t in T: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.