kata package¶
kata.admin module¶
kata.apps module¶
kata.forms module¶
-
class
kata.forms.KataBracketAddPersonForm(division=None, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm-
__init__(division=None, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
clean()[source]¶ Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
-
media¶
-
-
class
kata.forms.KataBracketAddTeamForm(division=None, **kwargs)[source]¶ Bases:
django.forms.models.ModelForm-
__init__(division=None, **kwargs)[source]¶ Initialize self. See help(type(self)) for accurate signature.
-
clean()[source]¶ Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
-
media¶
-
-
class
kata.forms.KataMatchForm(**kwargs)[source]¶ Bases:
django.forms.models.ModelForm-
clean()[source]¶ Hook for doing any extra form-wide cleaning after Field.clean() has been called on every field. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field named ‘__all__’.
-
media¶
-
kata.models module¶
-
class
kata.models.KataBracket(id, division)[source]¶ Bases:
django.db.models.base.Model- Parameters
id (AutoField) – Id
division (ForeignKey to
Division) – Division
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
division_id¶ Model field: division
-
id¶ Model field: ID
-
n_round¶
-
objects= <django.db.models.manager.Manager object>¶
-
rounds¶
-
class
kata.models.KataMatch(id, eventlink, round, done, score1, score2, score3, score4, score5, combined_score, tie_score)[source]¶ Bases:
django.db.models.base.Model- Parameters
id (AutoField) – Id
eventlink (ForeignKey to
EventLink) – Eventlinkround (ForeignKey to
KataRound) – Rounddone (BooleanField) – Done
score1 (DecimalField) – Score1
score2 (DecimalField) – Score2
score3 (DecimalField) – Score3
score4 (DecimalField) – Score4
score5 (DecimalField) – Score5
combined_score (DecimalField) – Combined score
tie_score (DecimalField) – Tie score
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
combined_score¶ Model field: combined score
-
done¶ Model field: done
-
eventlink_id¶ Model field: eventlink
-
id¶ Model field: ID
-
objects= <django.db.models.manager.Manager object>¶
-
round_id¶ Model field: round
-
save(*args, **kwargs)[source]¶ Save the current instance. Override this in a subclass if you want to control the saving process.
The ‘force_insert’ and ‘force_update’ parameters can be used to insist that the “save” must be an SQL insert or update (or equivalent for non-SQL backends), respectively. Normally, they should not be set.
-
score1¶ Model field: score1
-
score2¶ Model field: score2
-
score3¶ Model field: score3
-
score4¶ Model field: score4
-
score5¶ Model field: score5
-
scores¶
-
tie_score¶ Model field: tie score
-
class
kata.models.KataRound(id, bracket, round, order, prev_round, locked, n_winner_needed)[source]¶ Bases:
django.db.models.base.Model- Parameters
id (AutoField) – Id
bracket (ForeignKey to
KataBracket) – Bracketround (SmallIntegerField) – Round
order (SmallIntegerField) – Order
prev_round (ForeignKey to
KataRound) – Prev roundlocked (BooleanField) – Locked
n_winner_needed (PositiveSmallIntegerField) – N winner needed
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
bracket¶ Model field: bracket, accesses the
KataBracketmodel.
-
bracket_id¶ Model field: bracket
-
done¶
-
id¶ Model field: ID
-
locked¶ Model field: locked
-
matches¶
-
n_winner_needed¶ Model field: n winner needed
-
objects= <django.db.models.manager.Manager object>¶
-
order¶ Model field: order
-
prev_round_id¶ Model field: prev round
-
round¶ Model field: round
-
started¶
kata.test_views module¶
kata.tests module¶
-
class
kata.tests.TestKataBracket(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase-
test_rounding_error()[source]¶ Test for an issue where storing scores as floats has round off error and the wrong person wins.
a and d should have the same combined_score but a wins on the tie break. There can be round off error in d’s favour.
-
test_rounding_error_postgres()[source]¶ Test for an issue where storing scores as floats has round off error and the wrong person wins. Only failed on PostgreSQL.
a and b should have the same combined_score but b wins on the tie break. With PostgreSQL, the sort was working incorrectly and Django was incorrectly finding a tie. Seems like they were using slightly different numbers. Fixed by switching to DecimalField.
-
kata.urls module¶
kata.views module¶
-
class
kata.views.KataBracketAddMatch(**kwargs)[source]¶ Bases:
kata.views.KataBracketDetails,django.views.generic.edit.FormView-
form_class¶ alias of
kata.forms.KataBracketAddPersonForm
-
permission_required= 'accounts.edit'¶
-
post(request, *args, **kwargs)[source]¶ Handle POST requests: instantiate a form instance with the passed POST variables and then check if it’s valid.
-
template_name= 'kata/katabracket_detail.html'¶
-
-
class
kata.views.KataBracketAddTeamMatch(**kwargs)[source]¶ Bases:
kata.views.KataBracketAddMatch-
form_class¶ alias of
kata.forms.KataBracketAddTeamForm
-
permission_required= 'accounts.edit'¶
-
-
class
kata.views.KataBracketDeleteMatch(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.DeleteView-
delete(request, *args, **kwargs)[source]¶ Call the delete() method on the fetched object and then redirect to the success URL.
-
dispatch(request, *args, **kwargs)¶
-
get_object(queryset=None)[source]¶ Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
-
model¶ alias of
kata.models.KataMatch
-
permission_required= 'accounts.edit'¶
-
template_name= 'kata/katabracket_detail.html'¶
-
-
class
kata.views.KataBracketDetails(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.DetailView-
context_object_name= 'bracket'¶
-
model¶ alias of
kata.models.KataBracket
-
permission_required= 'accounts.view'¶
-
-
class
kata.views.KataBracketEditMatch(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.UpdateView-
form_class¶ alias of
kata.forms.KataMatchForm
-
get_object(queryset=None)[source]¶ Return the object the view is displaying.
Require self.queryset and a pk or slug argument in the URLconf. Subclasses can override this to return any object.
-
model¶ alias of
kata.models.KataMatch
-
permission_required= 'accounts.edit'¶
-
template_name= 'kata/katabracket_detail.html'¶
-