Skip to content

Commit

Permalink
Add killer.game != victim.game check in Kill.save()
Browse files Browse the repository at this point in the history
  • Loading branch information
kz26 committed Feb 25, 2016
1 parent 99897c2 commit f8eed32
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion uchicagohvz/game/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def clean_hvt(self):
def clean(self):
cleaned_data = super(KillAdminForm, self).clean()
if cleaned_data['killer'].game != cleaned_data['victim'].game:
raise forms.ValidationError('Killer and victim games do not match.')
raise forms.ValidationError('killer.game and victim.game do not match.')
return cleaned_data

class KillAdmin(admin.ModelAdmin):
Expand Down
2 changes: 2 additions & 0 deletions uchicagohvz/game/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -461,6 +461,8 @@ def refresh_points(self):
self.points = points

def save(self, *args, **kwargs):
if self.killer.game != self.victim.game:
raise Exception('killer.game and victim.game do not match.')
try:
parent = Kill.objects.exclude(id=self.id).filter(victim=self.killer)[0]
except:
Expand Down

0 comments on commit f8eed32

Please sign in to comment.