registration package¶
Submodules¶
registration.admin module¶
-
class
registration.admin.DivisionAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin-
get_form(request, obj=None, **kwargs)[source]¶ Return a Form class for use in the admin add view. This is used by add_view and change_view.
-
get_queryset(request)[source]¶ Return a QuerySet of all model instances that can be edited by the admin site. This is used by changelist_view.
-
inlines= (<class 'registration.admin.PersonInline'>,)¶
-
list_display= ['__str__', 'num_participants', 'event', 'gender', 'start_age', 'stop_age', 'start_rank', 'stop_rank']¶
-
list_editable= ['event', 'gender', 'start_age', 'stop_age', 'start_rank', 'stop_rank']¶
-
list_filter= ['event', 'gender', 'start_age', 'start_rank']¶
-
media¶
-
-
class
registration.admin.DivisionInline(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.TabularInline-
extra= 1¶
-
media¶
-
model¶ alias of
registration.models.EventLink
-
-
class
registration.admin.PersonAdmin(model, admin_site)[source]¶ Bases:
django.contrib.admin.options.ModelAdmin-
formfield_overrides= {<class 'django.db.models.fields.related.ManyToManyField'>: {'widget': <class 'django.forms.widgets.CheckboxSelectMultiple'>}}¶
-
inlines= (<class 'registration.admin.DivisionInline'>,)¶
-
list_display= ['full_name', 'gender', 'age', 'rank', 'paid']¶
-
list_filter= ['gender', 'age', 'rank', 'paid']¶
-
media¶
-
search_fields= ('first_name', 'last_name', 'instructor')¶
-
-
class
registration.admin.PersonInline(parent_model, admin_site)[source]¶ Bases:
django.contrib.admin.options.TabularInline-
extra= 0¶
-
media¶
-
model¶ alias of
registration.models.EventLink
-
readonly_fields= ['person', 'event']¶
-
registration.apps module¶
registration.forms module¶
-
class
registration.forms.ManualEventLinkForm(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
registration.forms.PersonCheckinForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelForm-
media¶
-
-
class
registration.forms.PersonFilterForm(*args, **kwargs)[source]¶ Bases:
django.forms.forms.FormForm fields:
name: Name (CharField)confirmed: Confirmed (TypedChoiceField)paid: Paid (TypedChoiceField)
-
media¶
-
class
registration.forms.PersonForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelForm-
media¶
-
-
class
registration.forms.PersonPaidForm(data=None, files=None, auto_id='id_%s', prefix=None, initial=None, error_class=<class 'django.forms.utils.ErrorList'>, label_suffix=None, empty_permitted=False, instance=None, use_required_attribute=None, renderer=None)[source]¶ Bases:
django.forms.models.ModelForm-
media¶
-
-
class
registration.forms.TeamAssignForm(division=None, **kwargs)[source]¶ Bases:
django.forms.forms.FormForm fields:
src: Src (ModelChoiceField)tgt: Tgt (ModelChoiceField)
-
__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¶
-
prefix= 'assign'¶
registration.models module¶
Module responsible for defining the events in which people can compete and registration. The rules used to run each event are provided by other modules.
An
Eventdefines an area in which you can compete, e.g. Kata or Kumite.A
Divisiondefines a range of ages, belt ranks, and genders who compete against eachother in an Event.A
Personstores the registration information for a competetor.For each Person, an
EventLinkis created for each Event in which they register.A
Rankis a utility table for populating the belt rank choices.
-
class
registration.models.Division(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA division is a group of people who will compete against eachother in a single event.
- Parameters
id (AutoField) – Id
event (ForeignKey to
Event) – Eventname (CharField) – Name
gender (CharField) – Gender
start_age (PositiveSmallIntegerField) – Start age
stop_age (PositiveSmallIntegerField) – Stop age
start_rank (ForeignKey to
Rank) – Start rankstop_rank (ForeignKey to
Rank) – Stop rankstate (CharField) – State
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
class
State[source]¶ Bases:
djchoices.choices.DjangoChoices-
attributes= {'1': 'ready', '4': 'running', '7': 'done'}¶
-
choices= (('1', 'ready'), ('4', 'running'), ('7', 'done'))¶
-
done= '7'¶
-
labels= {'done': 'done', 'ready': 'ready', 'running': 'running'}¶
-
ready= '1'¶
-
running= '4'¶
-
validator= <djchoices.choices.ChoicesValidator object>¶
-
values= {'1': 'ready', '4': 'running', '7': 'done'}¶
-
-
claim()[source]¶ Put people into this division.
If all members of a team move to the same division, they stay in a team. If some of the members move to a new division, only the members that stay in the original division will stay in a team.
-
event_id¶ Model field: event
-
gender¶ Model field: gender
-
get_confirmed_eventlinks()[source]¶ Returns the :class:`.EventLink`s that will participate in the division.
For individual events, the EventLinks for confirmed people and EventLinks that are manually added are returned.
For team events, the EventLinks that are teams are returned.
-
get_gender_display(*, field=<django.db.models.fields.CharField: gender>)¶ Autogenerated: Shows the label of the
gender
-
get_noshow_eventlinks()[source]¶ Returns the :class:`.EventLink`s that will NOT participate in the division.
For individual events, the EventLinks with confirmed=False are returned.
For team events, the EventLinks that are not assigned to teams are returned.
-
get_state_display(*, field=<django.db.models.fields.CharField: state>)¶ Autogenerated: Shows the label of the
state
-
id¶ Model field: ID
-
katabracket_set¶ Model field: division, accesses the M2M
KataBracketmodel.
-
name¶ Model field: name
-
objects= <django.db.models.manager.Manager object>¶
-
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.
-
start_age¶ Model field: start age
-
start_rank_id¶ Model field: start rank
-
state¶ Model field: state
-
status¶
-
stop_age¶ Model field: stop age
-
stop_rank_id¶ Model field: stop rank
-
class
registration.models.Event(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelThe events at the tournament in which you can compete. E.g. Kata or Kumite.
The events define the options that are presented to the users when they register. They also determine which the scoring rules used for each division.
- Parameters
id (AutoField) – Id
name (CharField) – Name
format (CharField) – Format
is_team (BooleanField) – Is team
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
class
EventFormat[source]¶ Bases:
djchoices.choices.DjangoChoices-
attributes= {'A': 'kata', 'B': 'elim1'}¶
-
choices= (('A', 'kata'), ('B', 'elim1'))¶
-
elim1= 'B'¶
-
kata= 'A'¶
-
labels= {'elim1': 'elim1', 'kata': 'kata'}¶
-
validator= <djchoices.choices.ChoicesValidator object>¶
-
values= {'A': 'kata', 'B': 'elim1'}¶
-
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
format¶ Model field: format
-
get_format_display(*, field=<django.db.models.fields.CharField: format>)¶ Autogenerated: Shows the label of the
format
-
id¶ Model field: ID
-
is_team¶ Model field: is team
-
name¶ Model field: name
-
objects= <django.db.models.manager.Manager object>¶
-
save(**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.
-
class
registration.models.EventLink(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA person participating in a
Division.If a person participates in multiple divisions, there will be multiple EventLinks.
Usually an EventLink links back to a
Personregistration. To support less sophisticated configurations or persons registering at ring-side, the EventLink may be created with only a name (manual_name) and no linked Person.An EventLink can represent a team of people participating in an event. In this case, there will be a EventLink for each person (with is_team=False), each of which has a team field that points to a shared EventLink (with is_team=True).
- Parameters
id (AutoField) – Id
person (ForeignKey to
Person) – Personmanual_name (CharField) – Manual name
event (ForeignKey to
Event) – Eventdivision (ForeignKey to
Division) – Divisionlocked (BooleanField) – Locked
disqualified (BooleanField) – Disqualified
is_team (BooleanField) – Is team
team (ForeignKey to
EventLink) – Team
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
clean()[source]¶ Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
-
disqualified¶ Model field: disqualified
-
division_id¶ Model field: division
-
event_id¶ Model field: event
-
id¶ Model field: ID
-
is_manual¶
-
is_team¶ Model field: is team
-
kumitematchperson_set¶ Model field: eventlink, accesses the M2M
KumiteMatchPersonmodel.
-
locked¶ Model field: locked
-
manual_name¶ Model field: manual name
-
name¶
-
objects= <django.db.models.manager.Manager object>¶
-
person_id¶ Model field: person
-
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.
-
team_id¶ Model field: team
-
class
registration.models.Person(id, first_name, last_name, gender, age, rank, instructor, phone_number, email, parent, teammates, reg_date, paid, paidDate, confirmed, notes)[source]¶ Bases:
django.db.models.base.Model- Parameters
id (AutoField) – Id
first_name (CharField) – First name
last_name (CharField) – Last name
gender (CharField) – Gender
age (PositiveSmallIntegerField) – Age
rank (ForeignKey to
Rank) – Rankinstructor (CharField) – Instructor
phone_number (CharField) – Phone number
email (EmailField) – Email
parent (CharField) – Parent or guardian (if under 18)
teammates (CharField) – Teammates
reg_date (DateTimeField) – Date registered
paid (BooleanField) – Paid
paidDate (DateField) – Date paid
confirmed (BooleanField) – Checked in
notes (TextField) – Notes
events (ManyToManyField) – Events
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
age¶ Model field: age
-
clean()[source]¶ Hook for doing any extra model-wide validation after clean() has been called on every field by self.clean_fields. Any ValidationError raised by this method will not be associated with a particular field; it will have a special-case association with the field defined by NON_FIELD_ERRORS.
-
confirmed¶ Model field: Checked in
-
email¶ Model field: email
-
first_name¶ Model field: first name
-
gender¶ Model field: gender
-
get_gender_display(*, field=<django.db.models.fields.CharField: gender>)¶ Autogenerated: Shows the label of the
gender
-
get_next_by_reg_date(*, field=<django.db.models.fields.DateTimeField: reg_date>, is_next=True, **kwargs)¶ Autogenerated: Finds next instance based on
reg_date.
-
get_previous_by_reg_date(*, field=<django.db.models.fields.DateTimeField: reg_date>, is_next=False, **kwargs)¶ Autogenerated: Finds previous instance based on
reg_date.
-
id¶ Model field: ID
-
instructor¶ Model field: instructor
-
last_name¶ Model field: last name
-
notes¶ Model field: notes
-
objects= <django.db.models.manager.Manager object>¶
-
paid¶ Model field: paid
-
paidDate¶ Model field: Date paid
-
parent¶ Model field: Parent or Guardian (if under 18)
-
phone_number¶ Model field: phone number
-
rank_id¶ Model field: rank
-
reg_date¶ Model field: Date registered
-
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.
-
teammates¶ Model field: teammates
-
class
registration.models.Rank(*args, **kwargs)[source]¶ Bases:
django.db.models.base.ModelA belt rank.
By default, kyu grades are stored with order having a value of -kyu and dan grades are stored with order having a value of dan.
Standard Karate ranks will be prepopulated in the database by the migration.
- Parameters
id (AutoField) – Id
order (SmallIntegerField) – Order
name (CharField) – Name
-
exception
DoesNotExist¶ Bases:
django.core.exceptions.ObjectDoesNotExist
-
exception
MultipleObjectsReturned¶ Bases:
django.core.exceptions.MultipleObjectsReturned
-
static
build_default_fixture(stream=None)[source]¶ Create a fixture file to populate the Rank table with default data.
If no output stream is provided, the fixture data is saved to fixtures/rank.json. The data is loaded automatically as part of the database migration. Alternatively, it can be loaded by calling:
./manage.py loaddata rank.json
- Args:
stream (optional): Stream where the data will be written.
-
id¶ Model field: ID
-
name¶ Model field: name
-
objects= <django.db.models.manager.Manager object>¶
-
order¶ Model field: order
-
registration.models.export_registrations(f)[source]¶ Export registration data as a csv file.
- Usage:
- with open(“filename.csv”, “w”, newline=’‘’‘) as f:
export_registrations(f)
-
registration.models.import_registrations(f)[source]¶ Import registration data from Google Forms csv.
- Usage
f = open(‘my_data.csv’, newline=’‘) import_registrations(f)
The date of the last registration is cached in the SIGNUP_IMPORT_LAST_TSTAMP setting to make it safe to repeatedly import the same data without creating duplicate registrations.
Input stream should be opened with newline=’’ or muti-line entries will not be parsed correctly.
Todo
Pay attention to timezones when parsing dates. See https://docs.djangoproject.com/en/1.11/topics/i18n/timezones/
registration.test_views module¶
-
class
registration.test_views.ConsoleTestCase_0(methodName='runTest')¶ Bases:
registration.test_views.ConsoleTestCase-
browser= <common.selenium.Env.cases.<locals>.Browser object>¶
-
test_console()¶
-
-
class
registration.test_views.DivisionDetailTestCase(methodName='runTest')[source]¶ Bases:
django_webtest.WebTest
registration.tests module¶
-
class
registration.tests.DivisionTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.EventLinkTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.EventTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.ImportExportRegistrationTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.PersonTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
-
class
registration.tests.RankTestCase(methodName='runTest')[source]¶ Bases:
django.test.testcases.TestCase
registration.urls module¶
registration.views module¶
-
class
registration.views.DetailView(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.DetailView-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.view'¶
-
-
class
registration.views.DivisionAddManualPerson(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.SingleObjectMixin,django.views.generic.edit.FormView-
dispatch(request, *args, **kwargs)¶
-
form_class¶
-
get_template_names()[source]¶ Return a list of template names to be used for the request. Must return a list. May not be called if render_to_response() is overridden.
-
model¶ alias of
registration.models.Division
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.DivisionBuild(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.SingleObjectMixin,django.views.generic.base.View-
dispatch(request, *args, **kwargs)¶
-
model¶ alias of
registration.models.Division
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.DivisionDeleteManaualPerson(**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()[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
registration.models.EventLink
-
permission_required= 'accounts.edit'¶
-
template_name= 'registration/division_detail.html'¶
-
-
class
registration.views.DivisionInfo(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.DetailView-
get_template_names()[source]¶ Return a list of template names to be used for the request. May not be called if render_to_response() is overridden. Return the following list:
the value of
template_nameon the view (if provided)the contents of the
template_name_fieldfield on the object instance that the view is operating upon (if available)<app_label>/<model_name><template_name_suffix>.html
-
model¶ alias of
registration.models.Division
-
permission_required= 'accounts.view'¶
-
-
class
registration.views.DivisionList(**kwargs)[source]¶ Bases:
django.views.generic.list.ListView-
model¶ alias of
registration.models.Division
-
orderby= ('event', 'start_age', 'start_rank__order')¶
-
-
class
registration.views.IndexView(*args, **kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.list.ListView,django.views.generic.edit.FormMixinMain view for displaying the registered competetors.
Related to
IndexViewTableandIndexViewTableRowwhich are used to redraw parts of this view dynamically. ViewsPersonPaidandPersonCheckinare called by clicking buttons in this view.-
form_class¶ alias of
registration.forms.PersonFilterForm
-
get_queryset()[source]¶ Return the list of items for this view.
The return value must be an iterable and may be an instance of QuerySet in which case QuerySet specific behavior will be enabled.
-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.view'¶
-
-
class
registration.views.IndexViewTable(*args, **kwargs)[source]¶ Bases:
registration.views.IndexView-
template_name= 'registration/person_list_table.html'¶
-
-
class
registration.views.IndexViewTableRow(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.detail.DetailView-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.view'¶
-
template_name= 'registration/person_list_table_row.html'¶
-
-
class
registration.views.MessageDemoView(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.base.TemplateView-
permission_required= 'accounts.view'¶
-
template_name= 'registration/message_demo.html'¶
-
-
class
registration.views.PersonCheckin(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.UpdateView-
form_class¶ alias of
registration.forms.PersonCheckinForm
-
inline= False¶
-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.PersonCreate(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.CreateView-
form_class¶ alias of
registration.forms.PersonForm
-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.PersonDelete(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.DeleteView-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.admin'¶
-
success_url= '/registration/'¶
-
-
class
registration.views.PersonPaid(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.UpdateView-
form_class¶ alias of
registration.forms.PersonPaidForm
-
inline= False¶
-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.PersonUpdate(**kwargs)[source]¶ Bases:
django.contrib.auth.mixins.PermissionRequiredMixin,django.views.generic.edit.UpdateView-
form_class¶ alias of
registration.forms.PersonForm
-
model¶ alias of
registration.models.Person
-
permission_required= 'accounts.edit'¶
-
-
class
registration.views.TeamAssignView(**kwargs)[source]¶ Bases:
registration.views.DivisionInfo,django.views.generic.edit.FormView-
dispatch(request, *args, **kwargs)¶
-
form_class¶ alias of
registration.forms.TeamAssignForm
-
permission_required= 'accounts.edit'¶
-