Skip to content

Commit d5065df

Browse files
committed
[fix] 500
1 parent e8ebc68 commit d5065df

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

status/models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Status(models.Model):
3333
additional_info = models.TextField(blank=True, null=True)
3434

3535
def __str__(self):
36-
return '[{id}] {owner}'.format(id=self.id, title=self.owner.username)
36+
return '[{id}] {owner}'.format(id=self.id, owner=self.owner.username)
3737

3838
class Meta:
3939
indexes = [

status/views.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ def process(x):
101101
status_filter = {}
102102
data = request.GET
103103

104-
if type(data.get('problem')) == int:
105-
status_filter['problem'] = get_object_or_404(Problem, pid=data['problem']).id
104+
if data.get('problem') is not None:
105+
if data['problem'].isdecimal():
106+
status_filter['problem'] = get_object_or_404(Problem, pid=int(data['problem'])).id
106107

107108
if data.get('lang') is not None:
108-
status_filter['lang'] = data['lang']
109+
if data['lang'].isdecimal():
110+
status_filter['lang'] = int(data['lang'])
109111

110112
if data.get('owner') is not None:
111-
status_filter['owner'] = data['owner']
112-
113-
if data.get('score') is not None:
114-
status_filter['score'] = data['score']
113+
if data['owner'].isdecimal():
114+
status_filter['owner'] = int(data['owner'])
115115

116116
queryset = Status.objects.filter(**status_filter).order_by('-add_time')
117117

0 commit comments

Comments
 (0)