repository_name stringlengths 7 55 | func_path_in_repository stringlengths 4 223 | func_name stringlengths 1 134 | whole_func_string stringlengths 75 104k | language stringclasses 1
value | func_code_string stringlengths 75 104k | func_code_tokens listlengths 19 28.4k | func_documentation_string stringlengths 1 46.9k | func_documentation_tokens listlengths 1 1.97k | split_name stringclasses 1
value | func_code_url stringlengths 87 315 |
|---|---|---|---|---|---|---|---|---|---|---|
django-danceschool/django-danceschool | danceschool/guestlist/models.py | GuestList.getDayStart | def getDayStart(self, dateTime):
''' Ensure local time and get the beginning of the day '''
return ensure_localtime(dateTime).replace(hour=0,minute=0,second=0,microsecond=0) | python | def getDayStart(self, dateTime):
''' Ensure local time and get the beginning of the day '''
return ensure_localtime(dateTime).replace(hour=0,minute=0,second=0,microsecond=0) | [
"def",
"getDayStart",
"(",
"self",
",",
"dateTime",
")",
":",
"return",
"ensure_localtime",
"(",
"dateTime",
")",
".",
"replace",
"(",
"hour",
"=",
"0",
",",
"minute",
"=",
"0",
",",
"second",
"=",
"0",
",",
"microsecond",
"=",
"0",
")"
] | Ensure local time and get the beginning of the day | [
"Ensure",
"local",
"time",
"and",
"get",
"the",
"beginning",
"of",
"the",
"day"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L69-L71 |
django-danceschool/django-danceschool | danceschool/guestlist/models.py | GuestList.getComponentFilters | def getComponentFilters(self,component,event=None,dateTime=None):
'''
Get a parsimonious set of intervals and the associated Q() objects
based on the occurrences of a specified event, and the rule that
implicitly defines the start and end of each interval.
'''
# Limit to... | python | def getComponentFilters(self,component,event=None,dateTime=None):
'''
Get a parsimonious set of intervals and the associated Q() objects
based on the occurrences of a specified event, and the rule that
implicitly defines the start and end of each interval.
'''
# Limit to... | [
"def",
"getComponentFilters",
"(",
"self",
",",
"component",
",",
"event",
"=",
"None",
",",
"dateTime",
"=",
"None",
")",
":",
"# Limit to the staff member or staff category specified by the rule.",
"if",
"component",
".",
"staffMember",
":",
"filters",
"=",
"Q",
"... | Get a parsimonious set of intervals and the associated Q() objects
based on the occurrences of a specified event, and the rule that
implicitly defines the start and end of each interval. | [
"Get",
"a",
"parsimonious",
"set",
"of",
"intervals",
"and",
"the",
"associated",
"Q",
"()",
"objects",
"based",
"on",
"the",
"occurrences",
"of",
"a",
"specified",
"event",
"and",
"the",
"rule",
"that",
"implicitly",
"defines",
"the",
"start",
"and",
"end",... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L73-L150 |
django-danceschool/django-danceschool | danceschool/guestlist/models.py | GuestList.getListForEvent | def getListForEvent(self, event=None):
''' Get the list of names associated with a particular event. '''
names = list(self.guestlistname_set.annotate(
guestType=Case(
When(notes__isnull=False, then=F('notes')),
default=Value(ugettext('Manually Added')),
... | python | def getListForEvent(self, event=None):
''' Get the list of names associated with a particular event. '''
names = list(self.guestlistname_set.annotate(
guestType=Case(
When(notes__isnull=False, then=F('notes')),
default=Value(ugettext('Manually Added')),
... | [
"def",
"getListForEvent",
"(",
"self",
",",
"event",
"=",
"None",
")",
":",
"names",
"=",
"list",
"(",
"self",
".",
"guestlistname_set",
".",
"annotate",
"(",
"guestType",
"=",
"Case",
"(",
"When",
"(",
"notes__isnull",
"=",
"False",
",",
"then",
"=",
... | Get the list of names associated with a particular event. | [
"Get",
"the",
"list",
"of",
"names",
"associated",
"with",
"a",
"particular",
"event",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L152-L191 |
django-danceschool/django-danceschool | danceschool/guestlist/models.py | GuestListComponent.clean | def clean(self):
''' Either staffCategory or staffMember must be filled in, but not both. '''
if not self.staffCategory and not self.staffMember:
raise ValidationError(_('Either staff category or staff member must be specified.'))
if self.staffCategory and self.staffMember:
... | python | def clean(self):
''' Either staffCategory or staffMember must be filled in, but not both. '''
if not self.staffCategory and not self.staffMember:
raise ValidationError(_('Either staff category or staff member must be specified.'))
if self.staffCategory and self.staffMember:
... | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"staffCategory",
"and",
"not",
"self",
".",
"staffMember",
":",
"raise",
"ValidationError",
"(",
"_",
"(",
"'Either staff category or staff member must be specified.'",
")",
")",
"if",
"self",
".",... | Either staffCategory or staffMember must be filled in, but not both. | [
"Either",
"staffCategory",
"or",
"staffMember",
"must",
"be",
"filled",
"in",
"but",
"not",
"both",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L237-L242 |
django-danceschool/django-danceschool | danceschool/core/ajax.py | updateSeriesAttributes | def updateSeriesAttributes(request):
'''
This function handles the filtering of available series classes and seriesteachers when a series
is chosen on the Substitute Teacher reporting form.
'''
if request.method == 'POST' and request.POST.get('event'):
series_option = request.POST.get(... | python | def updateSeriesAttributes(request):
'''
This function handles the filtering of available series classes and seriesteachers when a series
is chosen on the Substitute Teacher reporting form.
'''
if request.method == 'POST' and request.POST.get('event'):
series_option = request.POST.get(... | [
"def",
"updateSeriesAttributes",
"(",
"request",
")",
":",
"if",
"request",
".",
"method",
"==",
"'POST'",
"and",
"request",
".",
"POST",
".",
"get",
"(",
"'event'",
")",
":",
"series_option",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'event'",
")",... | This function handles the filtering of available series classes and seriesteachers when a series
is chosen on the Substitute Teacher reporting form. | [
"This",
"function",
"handles",
"the",
"filtering",
"of",
"available",
"series",
"classes",
"and",
"seriesteachers",
"when",
"a",
"series",
"is",
"chosen",
"on",
"the",
"Substitute",
"Teacher",
"reporting",
"form",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L54-L78 |
django-danceschool/django-danceschool | danceschool/core/ajax.py | processCheckIn | def processCheckIn(request):
'''
This function handles the Ajax call made when a user is marked as checked in
'''
if request.method == 'POST':
event_id = request.POST.get('event_id')
reg_ids = request.POST.getlist('reg_id')
if not event_id:
return HttpResp... | python | def processCheckIn(request):
'''
This function handles the Ajax call made when a user is marked as checked in
'''
if request.method == 'POST':
event_id = request.POST.get('event_id')
reg_ids = request.POST.getlist('reg_id')
if not event_id:
return HttpResp... | [
"def",
"processCheckIn",
"(",
"request",
")",
":",
"if",
"request",
".",
"method",
"==",
"'POST'",
":",
"event_id",
"=",
"request",
".",
"POST",
".",
"get",
"(",
"'event_id'",
")",
"reg_ids",
"=",
"request",
".",
"POST",
".",
"getlist",
"(",
"'reg_id'",
... | This function handles the Ajax call made when a user is marked as checked in | [
"This",
"function",
"handles",
"the",
"Ajax",
"call",
"made",
"when",
"a",
"user",
"is",
"marked",
"as",
"checked",
"in"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L81-L103 |
django-danceschool/django-danceschool | danceschool/core/ajax.py | getEmailTemplate | def getEmailTemplate(request):
'''
This function handles the Ajax call made when a user wants a specific email template
'''
if request.method != 'POST':
return HttpResponse(_('Error, no POST data.'))
if not hasattr(request,'user'):
return HttpResponse(_('Error, not authentic... | python | def getEmailTemplate(request):
'''
This function handles the Ajax call made when a user wants a specific email template
'''
if request.method != 'POST':
return HttpResponse(_('Error, no POST data.'))
if not hasattr(request,'user'):
return HttpResponse(_('Error, not authentic... | [
"def",
"getEmailTemplate",
"(",
"request",
")",
":",
"if",
"request",
".",
"method",
"!=",
"'POST'",
":",
"return",
"HttpResponse",
"(",
"_",
"(",
"'Error, no POST data.'",
")",
")",
"if",
"not",
"hasattr",
"(",
"request",
",",
"'user'",
")",
":",
"return"... | This function handles the Ajax call made when a user wants a specific email template | [
"This",
"function",
"handles",
"the",
"Ajax",
"call",
"made",
"when",
"a",
"user",
"wants",
"a",
"specific",
"email",
"template"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L106-L136 |
django-danceschool/django-danceschool | danceschool/payments/paypal/management/commands/setup_paypal.py | Command.boolean_input | def boolean_input(self, question, default=None):
'''
Method for yes/no boolean inputs
'''
result = input("%s: " % question)
if not result and default is not None:
return default
while len(result) < 1 or result[0].lower() not in "yn":
result... | python | def boolean_input(self, question, default=None):
'''
Method for yes/no boolean inputs
'''
result = input("%s: " % question)
if not result and default is not None:
return default
while len(result) < 1 or result[0].lower() not in "yn":
result... | [
"def",
"boolean_input",
"(",
"self",
",",
"question",
",",
"default",
"=",
"None",
")",
":",
"result",
"=",
"input",
"(",
"\"%s: \"",
"%",
"question",
")",
"if",
"not",
"result",
"and",
"default",
"is",
"not",
"None",
":",
"return",
"default",
"while",
... | Method for yes/no boolean inputs | [
"Method",
"for",
"yes",
"/",
"no",
"boolean",
"inputs"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/paypal/management/commands/setup_paypal.py#L16-L25 |
django-danceschool/django-danceschool | danceschool/financial/helpers.py | createExpenseItemsForVenueRental | def createExpenseItemsForVenueRental(request=None, datetimeTuple=None, rule=None, event=None):
'''
For each Location or Room-related Repeated Expense Rule, look for Events
in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, then generate... | python | def createExpenseItemsForVenueRental(request=None, datetimeTuple=None, rule=None, event=None):
'''
For each Location or Room-related Repeated Expense Rule, look for Events
in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, then generate... | [
"def",
"createExpenseItemsForVenueRental",
"(",
"request",
"=",
"None",
",",
"datetimeTuple",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"event",
"=",
"None",
")",
":",
"# These are used repeatedly, so they are put at the top\r",
"submissionUser",
"=",
"getattr",
"("... | For each Location or Room-related Repeated Expense Rule, look for Events
in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, then generate new expenses that are
associated with this rule. For non-hourly expenses, generate new expenses
b... | [
"For",
"each",
"Location",
"or",
"Room",
"-",
"related",
"Repeated",
"Expense",
"Rule",
"look",
"for",
"Events",
"in",
"the",
"designated",
"time",
"window",
"that",
"do",
"not",
"already",
"have",
"expenses",
"associated",
"with",
"them",
".",
"For",
"hourl... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/helpers.py#L121-L277 |
django-danceschool/django-danceschool | danceschool/financial/helpers.py | createExpenseItemsForEvents | def createExpenseItemsForEvents(request=None, datetimeTuple=None, rule=None, event=None):
'''
For each StaffMember-related Repeated Expense Rule, look for EventStaffMember
instances in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, the... | python | def createExpenseItemsForEvents(request=None, datetimeTuple=None, rule=None, event=None):
'''
For each StaffMember-related Repeated Expense Rule, look for EventStaffMember
instances in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, the... | [
"def",
"createExpenseItemsForEvents",
"(",
"request",
"=",
"None",
",",
"datetimeTuple",
"=",
"None",
",",
"rule",
"=",
"None",
",",
"event",
"=",
"None",
")",
":",
"# This is used repeatedly, so it is put at the top\r",
"submissionUser",
"=",
"getattr",
"(",
"reque... | For each StaffMember-related Repeated Expense Rule, look for EventStaffMember
instances in the designated time window that do not already have expenses associated
with them. For hourly rental expenses, then generate new expenses that are
associated with this rule. For non-hourly expenses, generate new ... | [
"For",
"each",
"StaffMember",
"-",
"related",
"Repeated",
"Expense",
"Rule",
"look",
"for",
"EventStaffMember",
"instances",
"in",
"the",
"designated",
"time",
"window",
"that",
"do",
"not",
"already",
"have",
"expenses",
"associated",
"with",
"them",
".",
"For"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/helpers.py#L280-L508 |
django-danceschool/django-danceschool | danceschool/financial/helpers.py | createGenericExpenseItems | def createGenericExpenseItems(request=None, datetimeTuple=None, rule=None):
'''
Generic repeated expenses are created by just entering an
expense at each exact point specified by the rule, without
regard for whether events are scheduled in the specified
window,
'''
# These are used ... | python | def createGenericExpenseItems(request=None, datetimeTuple=None, rule=None):
'''
Generic repeated expenses are created by just entering an
expense at each exact point specified by the rule, without
regard for whether events are scheduled in the specified
window,
'''
# These are used ... | [
"def",
"createGenericExpenseItems",
"(",
"request",
"=",
"None",
",",
"datetimeTuple",
"=",
"None",
",",
"rule",
"=",
"None",
")",
":",
"# These are used repeatedly, so they are put at the top\r",
"submissionUser",
"=",
"getattr",
"(",
"request",
",",
"'user'",
",",
... | Generic repeated expenses are created by just entering an
expense at each exact point specified by the rule, without
regard for whether events are scheduled in the specified
window, | [
"Generic",
"repeated",
"expenses",
"are",
"created",
"by",
"just",
"entering",
"an",
"expense",
"at",
"each",
"exact",
"point",
"specified",
"by",
"the",
"rule",
"without",
"regard",
"for",
"whether",
"events",
"are",
"scheduled",
"in",
"the",
"specified",
"wi... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/helpers.py#L511-L618 |
django-danceschool/django-danceschool | danceschool/vouchers/views.py | GiftCertificateCustomizeView.dispatch | def dispatch(self,request,*args,**kwargs):
'''
Check that a valid Invoice ID has been passed in session data,
and that said invoice is marked as paid.
'''
paymentSession = request.session.get(INVOICE_VALIDATION_STR, {})
self.invoiceID = paymentSession.get('invoiceID')
... | python | def dispatch(self,request,*args,**kwargs):
'''
Check that a valid Invoice ID has been passed in session data,
and that said invoice is marked as paid.
'''
paymentSession = request.session.get(INVOICE_VALIDATION_STR, {})
self.invoiceID = paymentSession.get('invoiceID')
... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"paymentSession",
"=",
"request",
".",
"session",
".",
"get",
"(",
"INVOICE_VALIDATION_STR",
",",
"{",
"}",
")",
"self",
".",
"invoiceID",
"=",
"paymen... | Check that a valid Invoice ID has been passed in session data,
and that said invoice is marked as paid. | [
"Check",
"that",
"a",
"valid",
"Invoice",
"ID",
"has",
"been",
"passed",
"in",
"session",
"data",
"and",
"that",
"said",
"invoice",
"is",
"marked",
"as",
"paid",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/views.py#L31-L50 |
django-danceschool/django-danceschool | danceschool/vouchers/views.py | GiftCertificateCustomizeView.form_valid | def form_valid(self,form):
'''
Create the gift certificate voucher with the indicated information and send
the email as directed.
'''
emailTo = form.cleaned_data.get('emailTo')
emailType = form.cleaned_data.get('emailType')
recipientName = form.cleaned_data.get('r... | python | def form_valid(self,form):
'''
Create the gift certificate voucher with the indicated information and send
the email as directed.
'''
emailTo = form.cleaned_data.get('emailTo')
emailType = form.cleaned_data.get('emailType')
recipientName = form.cleaned_data.get('r... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"emailTo",
"=",
"form",
".",
"cleaned_data",
".",
"get",
"(",
"'emailTo'",
")",
"emailType",
"=",
"form",
".",
"cleaned_data",
".",
"get",
"(",
"'emailType'",
")",
"recipientName",
"=",
"form",
"."... | Create the gift certificate voucher with the indicated information and send
the email as directed. | [
"Create",
"the",
"gift",
"certificate",
"voucher",
"with",
"the",
"indicated",
"information",
"and",
"send",
"the",
"email",
"as",
"directed",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/views.py#L52-L131 |
django-danceschool/django-danceschool | danceschool/core/tasks.py | updateSeriesRegistrationStatus | def updateSeriesRegistrationStatus():
'''
Every hour, check if the series that are currently open for registration
should be closed.
'''
from .models import Series
if not getConstant('general__enableCronTasks'):
return
logger.info('Checking status of Series that are open ... | python | def updateSeriesRegistrationStatus():
'''
Every hour, check if the series that are currently open for registration
should be closed.
'''
from .models import Series
if not getConstant('general__enableCronTasks'):
return
logger.info('Checking status of Series that are open ... | [
"def",
"updateSeriesRegistrationStatus",
"(",
")",
":",
"from",
".",
"models",
"import",
"Series",
"if",
"not",
"getConstant",
"(",
"'general__enableCronTasks'",
")",
":",
"return",
"logger",
".",
"info",
"(",
"'Checking status of Series that are open for registration.'",... | Every hour, check if the series that are currently open for registration
should be closed. | [
"Every",
"hour",
"check",
"if",
"the",
"series",
"that",
"are",
"currently",
"open",
"for",
"registration",
"should",
"be",
"closed",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/tasks.py#L19-L34 |
django-danceschool/django-danceschool | danceschool/core/tasks.py | clearExpiredTemporaryRegistrations | def clearExpiredTemporaryRegistrations():
'''
Every hour, look for TemporaryRegistrations that have expired and delete them.
To ensure that there are no issues that arise from slight differences between
session expiration dates and TemporaryRegistration expiration dates, only
delete instances t... | python | def clearExpiredTemporaryRegistrations():
'''
Every hour, look for TemporaryRegistrations that have expired and delete them.
To ensure that there are no issues that arise from slight differences between
session expiration dates and TemporaryRegistration expiration dates, only
delete instances t... | [
"def",
"clearExpiredTemporaryRegistrations",
"(",
")",
":",
"from",
".",
"models",
"import",
"TemporaryRegistration",
"if",
"not",
"getConstant",
"(",
"'general__enableCronTasks'",
")",
":",
"return",
"if",
"getConstant",
"(",
"'registration__deleteExpiredTemporaryRegistrat... | Every hour, look for TemporaryRegistrations that have expired and delete them.
To ensure that there are no issues that arise from slight differences between
session expiration dates and TemporaryRegistration expiration dates, only
delete instances that have been expired for one minute. | [
"Every",
"hour",
"look",
"for",
"TemporaryRegistrations",
"that",
"have",
"expired",
"and",
"delete",
"them",
".",
"To",
"ensure",
"that",
"there",
"are",
"no",
"issues",
"that",
"arise",
"from",
"slight",
"differences",
"between",
"session",
"expiration",
"date... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/tasks.py#L38-L52 |
django-danceschool/django-danceschool | danceschool/financial/tasks.py | updateFinancialItems | def updateFinancialItems():
'''
Every hour, create any necessary revenue items and expense items for
activities that need them.
'''
if not getConstant('general__enableCronTasks'):
return
logger.info('Creating automatically-generated financial items.')
if getConstant('financial__aut... | python | def updateFinancialItems():
'''
Every hour, create any necessary revenue items and expense items for
activities that need them.
'''
if not getConstant('general__enableCronTasks'):
return
logger.info('Creating automatically-generated financial items.')
if getConstant('financial__aut... | [
"def",
"updateFinancialItems",
"(",
")",
":",
"if",
"not",
"getConstant",
"(",
"'general__enableCronTasks'",
")",
":",
"return",
"logger",
".",
"info",
"(",
"'Creating automatically-generated financial items.'",
")",
"if",
"getConstant",
"(",
"'financial__autoGenerateExpe... | Every hour, create any necessary revenue items and expense items for
activities that need them. | [
"Every",
"hour",
"create",
"any",
"necessary",
"revenue",
"items",
"and",
"expense",
"items",
"for",
"activities",
"that",
"need",
"them",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/tasks.py#L15-L30 |
django-danceschool/django-danceschool | danceschool/core/helpers.py | emailErrorMessage | def emailErrorMessage(subject,message):
'''
Useful for sending error messages via email.
'''
if not getConstant('email__enableErrorEmails'):
logger.info('Not sending error email: error emails are not enabled.')
return
send_from = getConstant('email__errorEmailFrom')
send_to = ge... | python | def emailErrorMessage(subject,message):
'''
Useful for sending error messages via email.
'''
if not getConstant('email__enableErrorEmails'):
logger.info('Not sending error email: error emails are not enabled.')
return
send_from = getConstant('email__errorEmailFrom')
send_to = ge... | [
"def",
"emailErrorMessage",
"(",
"subject",
",",
"message",
")",
":",
"if",
"not",
"getConstant",
"(",
"'email__enableErrorEmails'",
")",
":",
"logger",
".",
"info",
"(",
"'Not sending error email: error emails are not enabled.'",
")",
"return",
"send_from",
"=",
"get... | Useful for sending error messages via email. | [
"Useful",
"for",
"sending",
"error",
"messages",
"via",
"email",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/helpers.py#L15-L36 |
django-danceschool/django-danceschool | danceschool/core/helpers.py | getReturnPage | def getReturnPage(siteHistory,prior=False):
'''
This helper function is called in various places to get the return page from current
session data. The session data (in the 'SITE_HISTORY' key) is a required argument.
'''
expiry = parse_datetime(
siteHistory.get('expiry',''),
)
if pr... | python | def getReturnPage(siteHistory,prior=False):
'''
This helper function is called in various places to get the return page from current
session data. The session data (in the 'SITE_HISTORY' key) is a required argument.
'''
expiry = parse_datetime(
siteHistory.get('expiry',''),
)
if pr... | [
"def",
"getReturnPage",
"(",
"siteHistory",
",",
"prior",
"=",
"False",
")",
":",
"expiry",
"=",
"parse_datetime",
"(",
"siteHistory",
".",
"get",
"(",
"'expiry'",
",",
"''",
")",
",",
")",
"if",
"prior",
":",
"returnPage",
"=",
"siteHistory",
".",
"get"... | This helper function is called in various places to get the return page from current
session data. The session data (in the 'SITE_HISTORY' key) is a required argument. | [
"This",
"helper",
"function",
"is",
"called",
"in",
"various",
"places",
"to",
"get",
"the",
"return",
"page",
"from",
"current",
"session",
"data",
".",
"The",
"session",
"data",
"(",
"in",
"the",
"SITE_HISTORY",
"key",
")",
"is",
"a",
"required",
"argume... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/helpers.py#L39-L61 |
django-danceschool/django-danceschool | danceschool/financial/views.py | FinancesByPeriodView.get | def get(self,request,*args,**kwargs):
'''
Allow passing of basis and time limitations
'''
try:
year = int(self.kwargs.get('year'))
except (ValueError, TypeError):
year = getIntFromGet(request,'year')
kwargs.update({
'year': year,
... | python | def get(self,request,*args,**kwargs):
'''
Allow passing of basis and time limitations
'''
try:
year = int(self.kwargs.get('year'))
except (ValueError, TypeError):
year = getIntFromGet(request,'year')
kwargs.update({
'year': year,
... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"year",
"=",
"int",
"(",
"self",
".",
"kwargs",
".",
"get",
"(",
"'year'",
")",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
... | Allow passing of basis and time limitations | [
"Allow",
"passing",
"of",
"basis",
"and",
"time",
"limitations"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L303-L320 |
django-danceschool/django-danceschool | danceschool/financial/views.py | FinancialDetailView.get | def get(self,request,*args,**kwargs):
'''
Pass any permissable GET data. URL parameters override GET parameters
'''
try:
year = int(self.kwargs.get('year'))
except (ValueError, TypeError):
year = getIntFromGet(request,'year')
if self.kwargs.get('... | python | def get(self,request,*args,**kwargs):
'''
Pass any permissable GET data. URL parameters override GET parameters
'''
try:
year = int(self.kwargs.get('year'))
except (ValueError, TypeError):
year = getIntFromGet(request,'year')
if self.kwargs.get('... | [
"def",
"get",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"try",
":",
"year",
"=",
"int",
"(",
"self",
".",
"kwargs",
".",
"get",
"(",
"'year'",
")",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
... | Pass any permissable GET data. URL parameters override GET parameters | [
"Pass",
"any",
"permissable",
"GET",
"data",
".",
"URL",
"parameters",
"override",
"GET",
"parameters"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L428-L473 |
django-danceschool/django-danceschool | danceschool/financial/views.py | CompensationActionView.get_form_kwargs | def get_form_kwargs(self, **kwargs):
''' pass the list of staff members along to the form '''
kwargs = super(CompensationActionView, self).get_form_kwargs(**kwargs)
kwargs['staffmembers'] = self.queryset
return kwargs | python | def get_form_kwargs(self, **kwargs):
''' pass the list of staff members along to the form '''
kwargs = super(CompensationActionView, self).get_form_kwargs(**kwargs)
kwargs['staffmembers'] = self.queryset
return kwargs | [
"def",
"get_form_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"CompensationActionView",
",",
"self",
")",
".",
"get_form_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'staffmembers'",
"]",
"=",
"self",
".... | pass the list of staff members along to the form | [
"pass",
"the",
"list",
"of",
"staff",
"members",
"along",
"to",
"the",
"form"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L631-L635 |
django-danceschool/django-danceschool | danceschool/private_events/forms.py | EventOccurrenceCustomFormSet.setReminder | def setReminder(self,occurrence):
'''
This function is called to create the actual reminders for each occurrence that is created.
'''
sendReminderTo = self[0].cleaned_data['sendReminderTo']
sendReminderWhen = self[0].cleaned_data['sendReminderWhen']
sendReminderGrou... | python | def setReminder(self,occurrence):
'''
This function is called to create the actual reminders for each occurrence that is created.
'''
sendReminderTo = self[0].cleaned_data['sendReminderTo']
sendReminderWhen = self[0].cleaned_data['sendReminderWhen']
sendReminderGrou... | [
"def",
"setReminder",
"(",
"self",
",",
"occurrence",
")",
":",
"sendReminderTo",
"=",
"self",
"[",
"0",
"]",
".",
"cleaned_data",
"[",
"'sendReminderTo'",
"]",
"sendReminderWhen",
"=",
"self",
"[",
"0",
"]",
".",
"cleaned_data",
"[",
"'sendReminderWhen'",
"... | This function is called to create the actual reminders for each occurrence that is created. | [
"This",
"function",
"is",
"called",
"to",
"create",
"the",
"actual",
"reminders",
"for",
"each",
"occurrence",
"that",
"is",
"created",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_events/forms.py#L181-L208 |
django-danceschool/django-danceschool | danceschool/core/utils/requests.py | getIntFromGet | def getIntFromGet(request,key):
'''
This function just parses the request GET data for the requested key,
and returns it as an integer, returning none if the key is not
available or is in incorrect format.
'''
try:
return int(request.GET.get(key))
except (ValueError, TypeErro... | python | def getIntFromGet(request,key):
'''
This function just parses the request GET data for the requested key,
and returns it as an integer, returning none if the key is not
available or is in incorrect format.
'''
try:
return int(request.GET.get(key))
except (ValueError, TypeErro... | [
"def",
"getIntFromGet",
"(",
"request",
",",
"key",
")",
":",
"try",
":",
"return",
"int",
"(",
"request",
".",
"GET",
".",
"get",
"(",
"key",
")",
")",
"except",
"(",
"ValueError",
",",
"TypeError",
")",
":",
"return",
"None"
] | This function just parses the request GET data for the requested key,
and returns it as an integer, returning none if the key is not
available or is in incorrect format. | [
"This",
"function",
"just",
"parses",
"the",
"request",
"GET",
"data",
"for",
"the",
"requested",
"key",
"and",
"returns",
"it",
"as",
"an",
"integer",
"returning",
"none",
"if",
"the",
"key",
"is",
"not",
"available",
"or",
"is",
"in",
"incorrect",
"forma... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/requests.py#L7-L16 |
django-danceschool/django-danceschool | danceschool/core/utils/requests.py | getDateTimeFromGet | def getDateTimeFromGet(request,key):
'''
This function just parses the request GET data for the requested key,
and returns it in datetime format, returning none if the key is not
available or is in incorrect format.
'''
if request.GET.get(key,''):
try:
return ensure_t... | python | def getDateTimeFromGet(request,key):
'''
This function just parses the request GET data for the requested key,
and returns it in datetime format, returning none if the key is not
available or is in incorrect format.
'''
if request.GET.get(key,''):
try:
return ensure_t... | [
"def",
"getDateTimeFromGet",
"(",
"request",
",",
"key",
")",
":",
"if",
"request",
".",
"GET",
".",
"get",
"(",
"key",
",",
"''",
")",
":",
"try",
":",
"return",
"ensure_timezone",
"(",
"datetime",
".",
"strptime",
"(",
"unquote",
"(",
"request",
".",... | This function just parses the request GET data for the requested key,
and returns it in datetime format, returning none if the key is not
available or is in incorrect format. | [
"This",
"function",
"just",
"parses",
"the",
"request",
"GET",
"data",
"for",
"the",
"requested",
"key",
"and",
"returns",
"it",
"in",
"datetime",
"format",
"returning",
"none",
"if",
"the",
"key",
"is",
"not",
"available",
"or",
"is",
"in",
"incorrect",
"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/requests.py#L19-L30 |
django-danceschool/django-danceschool | danceschool/private_lessons/handlers.py | finalizePrivateLessonRegistration | def finalizePrivateLessonRegistration(sender,**kwargs):
'''
Once a private lesson registration is finalized, mark the slots that were
used to book the private lesson as booked and associate them with the final
registration. No need to notify students in this instance because they are
already r... | python | def finalizePrivateLessonRegistration(sender,**kwargs):
'''
Once a private lesson registration is finalized, mark the slots that were
used to book the private lesson as booked and associate them with the final
registration. No need to notify students in this instance because they are
already r... | [
"def",
"finalizePrivateLessonRegistration",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"finalReg",
"=",
"kwargs",
".",
"pop",
"(",
"'registration'",
")",
"for",
"er",
"in",
"finalReg",
".",
"eventregistration_set",
".",
"filter",
"(",
"event__privatelesso... | Once a private lesson registration is finalized, mark the slots that were
used to book the private lesson as booked and associate them with the final
registration. No need to notify students in this instance because they are
already receiving a notification of their registration. | [
"Once",
"a",
"private",
"lesson",
"registration",
"is",
"finalized",
"mark",
"the",
"slots",
"that",
"were",
"used",
"to",
"book",
"the",
"private",
"lesson",
"as",
"booked",
"and",
"associate",
"them",
"with",
"the",
"final",
"registration",
".",
"No",
"nee... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/handlers.py#L6-L19 |
django-danceschool/django-danceschool | danceschool/payments/stripe/cms_plugins.py | StripeGiftCertificateFormPlugin.render | def render(self, context, instance, placeholder):
''' Create a UUID and check if a voucher with that ID exists before rendering '''
context = super(StripeGiftCertificateFormPlugin, self).render(context, instance, placeholder)
context.update({
'stripe_key': getattr(settings,'STR... | python | def render(self, context, instance, placeholder):
''' Create a UUID and check if a voucher with that ID exists before rendering '''
context = super(StripeGiftCertificateFormPlugin, self).render(context, instance, placeholder)
context.update({
'stripe_key': getattr(settings,'STR... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"StripeGiftCertificateFormPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"context"... | Create a UUID and check if a voucher with that ID exists before rendering | [
"Create",
"a",
"UUID",
"and",
"check",
"if",
"a",
"voucher",
"with",
"that",
"ID",
"exists",
"before",
"rendering"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/stripe/cms_plugins.py#L18-L28 |
django-danceschool/django-danceschool | danceschool/core/utils/emails.py | get_text_for_html | def get_text_for_html(html_content):
'''
Take the HTML content (from, for example, an email)
and construct a simple plain text version of that content
(for example, for inclusion in a multipart email message).
'''
soup = BeautifulSoup(html_content)
# kill all script and style elem... | python | def get_text_for_html(html_content):
'''
Take the HTML content (from, for example, an email)
and construct a simple plain text version of that content
(for example, for inclusion in a multipart email message).
'''
soup = BeautifulSoup(html_content)
# kill all script and style elem... | [
"def",
"get_text_for_html",
"(",
"html_content",
")",
":",
"soup",
"=",
"BeautifulSoup",
"(",
"html_content",
")",
"# kill all script and style elements\r",
"for",
"script",
"in",
"soup",
"(",
"[",
"\"script\"",
",",
"\"style\"",
"]",
")",
":",
"script",
".",
"e... | Take the HTML content (from, for example, an email)
and construct a simple plain text version of that content
(for example, for inclusion in a multipart email message). | [
"Take",
"the",
"HTML",
"content",
"(",
"from",
"for",
"example",
"an",
"email",
")",
"and",
"construct",
"a",
"simple",
"plain",
"text",
"version",
"of",
"that",
"content",
"(",
"for",
"example",
"for",
"inclusion",
"in",
"a",
"multipart",
"email",
"messag... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/emails.py#L4-L31 |
django-danceschool/django-danceschool | danceschool/financial/admin.py | resetStaffCompensationInfo | def resetStaffCompensationInfo(self, request, queryset):
'''
This action is added to the list for staff member to permit bulk
reseting to category defaults of compensation information for staff members.
'''
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
ct = ContentType.objects.get_... | python | def resetStaffCompensationInfo(self, request, queryset):
'''
This action is added to the list for staff member to permit bulk
reseting to category defaults of compensation information for staff members.
'''
selected = request.POST.getlist(admin.ACTION_CHECKBOX_NAME)
ct = ContentType.objects.get_... | [
"def",
"resetStaffCompensationInfo",
"(",
"self",
",",
"request",
",",
"queryset",
")",
":",
"selected",
"=",
"request",
".",
"POST",
".",
"getlist",
"(",
"admin",
".",
"ACTION_CHECKBOX_NAME",
")",
"ct",
"=",
"ContentType",
".",
"objects",
".",
"get_for_model"... | This action is added to the list for staff member to permit bulk
reseting to category defaults of compensation information for staff members. | [
"This",
"action",
"is",
"added",
"to",
"the",
"list",
"for",
"staff",
"member",
"to",
"permit",
"bulk",
"reseting",
"to",
"category",
"defaults",
"of",
"compensation",
"information",
"for",
"staff",
"members",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/admin.py#L382-L389 |
django-danceschool/django-danceschool | danceschool/financial/admin.py | RepeatedExpenseRuleChildAdmin.get_fieldsets | def get_fieldsets(self, request, obj=None):
''' Override polymorphic default to put the subclass-specific fields first '''
# If subclass declares fieldsets, this is respected
if (hasattr(self, 'declared_fieldset') and self.declared_fieldsets) \
or not self.base_fieldsets:
... | python | def get_fieldsets(self, request, obj=None):
''' Override polymorphic default to put the subclass-specific fields first '''
# If subclass declares fieldsets, this is respected
if (hasattr(self, 'declared_fieldset') and self.declared_fieldsets) \
or not self.base_fieldsets:
... | [
"def",
"get_fieldsets",
"(",
"self",
",",
"request",
",",
"obj",
"=",
"None",
")",
":",
"# If subclass declares fieldsets, this is respected",
"if",
"(",
"hasattr",
"(",
"self",
",",
"'declared_fieldset'",
")",
"and",
"self",
".",
"declared_fieldsets",
")",
"or",
... | Override polymorphic default to put the subclass-specific fields first | [
"Override",
"polymorphic",
"default",
"to",
"put",
"the",
"subclass",
"-",
"specific",
"fields",
"first"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/admin.py#L427-L441 |
django-danceschool/django-danceschool | danceschool/core/management/commands/setupschool.py | Command.pattern_input | def pattern_input(self, question, message='Invalid entry', pattern='^[a-zA-Z0-9_ ]+$', default='',required=True):
'''
Method for input disallowing special characters, with optionally
specifiable regex pattern and error message.
'''
result = ''
requiredFlag = True
... | python | def pattern_input(self, question, message='Invalid entry', pattern='^[a-zA-Z0-9_ ]+$', default='',required=True):
'''
Method for input disallowing special characters, with optionally
specifiable regex pattern and error message.
'''
result = ''
requiredFlag = True
... | [
"def",
"pattern_input",
"(",
"self",
",",
"question",
",",
"message",
"=",
"'Invalid entry'",
",",
"pattern",
"=",
"'^[a-zA-Z0-9_ ]+$'",
",",
"default",
"=",
"''",
",",
"required",
"=",
"True",
")",
":",
"result",
"=",
"''",
"requiredFlag",
"=",
"True",
"w... | Method for input disallowing special characters, with optionally
specifiable regex pattern and error message. | [
"Method",
"for",
"input",
"disallowing",
"special",
"characters",
"with",
"optionally",
"specifiable",
"regex",
"pattern",
"and",
"error",
"message",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/management/commands/setupschool.py#L36-L58 |
django-danceschool/django-danceschool | danceschool/core/management/commands/setupschool.py | Command.float_input | def float_input(self, question, message='Invalid entry', default=None, required=True):
'''
Method for floating point inputs with optionally specifiable error message.
'''
float_result = None
requiredFlag = True
while (float_result is None and requiredFlag):
r... | python | def float_input(self, question, message='Invalid entry', default=None, required=True):
'''
Method for floating point inputs with optionally specifiable error message.
'''
float_result = None
requiredFlag = True
while (float_result is None and requiredFlag):
r... | [
"def",
"float_input",
"(",
"self",
",",
"question",
",",
"message",
"=",
"'Invalid entry'",
",",
"default",
"=",
"None",
",",
"required",
"=",
"True",
")",
":",
"float_result",
"=",
"None",
"requiredFlag",
"=",
"True",
"while",
"(",
"float_result",
"is",
"... | Method for floating point inputs with optionally specifiable error message. | [
"Method",
"for",
"floating",
"point",
"inputs",
"with",
"optionally",
"specifiable",
"error",
"message",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/management/commands/setupschool.py#L60-L81 |
django-danceschool/django-danceschool | danceschool/core/utils/timezone.py | ensure_timezone | def ensure_timezone(dateTime,timeZone=None):
'''
Since this project is designed to be used in both time-zone aware
and naive environments, this utility just returns a datetime as either
aware or naive depending on whether time zone support is enabled.
'''
if is_aware(dateTime) and not ge... | python | def ensure_timezone(dateTime,timeZone=None):
'''
Since this project is designed to be used in both time-zone aware
and naive environments, this utility just returns a datetime as either
aware or naive depending on whether time zone support is enabled.
'''
if is_aware(dateTime) and not ge... | [
"def",
"ensure_timezone",
"(",
"dateTime",
",",
"timeZone",
"=",
"None",
")",
":",
"if",
"is_aware",
"(",
"dateTime",
")",
"and",
"not",
"getattr",
"(",
"settings",
",",
"'USE_TZ'",
",",
"False",
")",
":",
"return",
"make_naive",
"(",
"dateTime",
",",
"t... | Since this project is designed to be used in both time-zone aware
and naive environments, this utility just returns a datetime as either
aware or naive depending on whether time zone support is enabled. | [
"Since",
"this",
"project",
"is",
"designed",
"to",
"be",
"used",
"in",
"both",
"time",
"-",
"zone",
"aware",
"and",
"naive",
"environments",
"this",
"utility",
"just",
"returns",
"a",
"datetime",
"as",
"either",
"aware",
"or",
"naive",
"depending",
"on",
... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/timezone.py#L5-L17 |
django-danceschool/django-danceschool | danceschool/payments/paypal/cms_plugins.py | GiftCertificateFormPlugin.render | def render(self, context, instance, placeholder):
''' Create a UUID and check if a voucher with that ID exists before rendering '''
context = super(GiftCertificateFormPlugin, self).render(context, instance, placeholder)
# Paypal "live" mode is "production" to checkout.js
mode = get... | python | def render(self, context, instance, placeholder):
''' Create a UUID and check if a voucher with that ID exists before rendering '''
context = super(GiftCertificateFormPlugin, self).render(context, instance, placeholder)
# Paypal "live" mode is "production" to checkout.js
mode = get... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"GiftCertificateFormPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"# Paypal \"liv... | Create a UUID and check if a voucher with that ID exists before rendering | [
"Create",
"a",
"UUID",
"and",
"check",
"if",
"a",
"voucher",
"with",
"that",
"ID",
"exists",
"before",
"rendering"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/paypal/cms_plugins.py#L17-L30 |
django-danceschool/django-danceschool | danceschool/financial/migrations/0012_auto_20181216_1615.py | getFullName | def getFullName(obj):
'''
This function replaces the fullName property for StaffMembers and the
get_full_name() method for Users, since those methods are not available
in the migration.
'''
if hasattr(obj, 'firstName') and hasattr(obj, 'lastName'):
return ' '.join([obj.firstName or '', o... | python | def getFullName(obj):
'''
This function replaces the fullName property for StaffMembers and the
get_full_name() method for Users, since those methods are not available
in the migration.
'''
if hasattr(obj, 'firstName') and hasattr(obj, 'lastName'):
return ' '.join([obj.firstName or '', o... | [
"def",
"getFullName",
"(",
"obj",
")",
":",
"if",
"hasattr",
"(",
"obj",
",",
"'firstName'",
")",
"and",
"hasattr",
"(",
"obj",
",",
"'lastName'",
")",
":",
"return",
"' '",
".",
"join",
"(",
"[",
"obj",
".",
"firstName",
"or",
"''",
",",
"obj",
".... | This function replaces the fullName property for StaffMembers and the
get_full_name() method for Users, since those methods are not available
in the migration. | [
"This",
"function",
"replaces",
"the",
"fullName",
"property",
"for",
"StaffMembers",
"and",
"the",
"get_full_name",
"()",
"method",
"for",
"Users",
"since",
"those",
"methods",
"are",
"not",
"available",
"in",
"the",
"migration",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/migrations/0012_auto_20181216_1615.py#L13-L21 |
django-danceschool/django-danceschool | danceschool/financial/migrations/0012_auto_20181216_1615.py | createPartyFromName | def createPartyFromName(apps, name):
'''
For creating/matching TransactionParty objects using names alone.
Look for staff members with the same name and match to them first if there is
exactly one match. Then, look for users and match them if there is exactly one
match. Otherwise, just generate a T... | python | def createPartyFromName(apps, name):
'''
For creating/matching TransactionParty objects using names alone.
Look for staff members with the same name and match to them first if there is
exactly one match. Then, look for users and match them if there is exactly one
match. Otherwise, just generate a T... | [
"def",
"createPartyFromName",
"(",
"apps",
",",
"name",
")",
":",
"TransactionParty",
"=",
"apps",
".",
"get_model",
"(",
"'financial'",
",",
"'TransactionParty'",
")",
"StaffMember",
"=",
"apps",
".",
"get_model",
"(",
"'core'",
",",
"'StaffMember'",
")",
"Us... | For creating/matching TransactionParty objects using names alone.
Look for staff members with the same name and match to them first if there is
exactly one match. Then, look for users and match them if there is exactly one
match. Otherwise, just generate a TransactionParty for the name only. | [
"For",
"creating",
"/",
"matching",
"TransactionParty",
"objects",
"using",
"names",
"alone",
".",
"Look",
"for",
"staff",
"members",
"with",
"the",
"same",
"name",
"and",
"match",
"to",
"them",
"first",
"if",
"there",
"is",
"exactly",
"one",
"match",
".",
... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/migrations/0012_auto_20181216_1615.py#L24-L68 |
django-danceschool/django-danceschool | danceschool/financial/migrations/0012_auto_20181216_1615.py | update_payTo | def update_payTo(apps, schema_editor):
'''
With the new TransactionParty model, the senders and recipients of financial
transactions are held in one place. So, we need to loop through old ExpenseItems,
RevenueItems, and GenericRepeatedExpense and move their old party references
to the new party mod... | python | def update_payTo(apps, schema_editor):
'''
With the new TransactionParty model, the senders and recipients of financial
transactions are held in one place. So, we need to loop through old ExpenseItems,
RevenueItems, and GenericRepeatedExpense and move their old party references
to the new party mod... | [
"def",
"update_payTo",
"(",
"apps",
",",
"schema_editor",
")",
":",
"TransactionParty",
"=",
"apps",
".",
"get_model",
"(",
"'financial'",
",",
"'TransactionParty'",
")",
"ExpenseItem",
"=",
"apps",
".",
"get_model",
"(",
"'financial'",
",",
"'ExpenseItem'",
")"... | With the new TransactionParty model, the senders and recipients of financial
transactions are held in one place. So, we need to loop through old ExpenseItems,
RevenueItems, and GenericRepeatedExpense and move their old party references
to the new party model. | [
"With",
"the",
"new",
"TransactionParty",
"model",
"the",
"senders",
"and",
"recipients",
"of",
"financial",
"transactions",
"are",
"held",
"in",
"one",
"place",
".",
"So",
"we",
"need",
"to",
"loop",
"through",
"old",
"ExpenseItems",
"RevenueItems",
"and",
"G... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/migrations/0012_auto_20181216_1615.py#L71-L119 |
django-danceschool/django-danceschool | danceschool/discounts/migrations/0005_auto_20170830_1159.py | create_initial_category | def create_initial_category(apps, schema_editor):
''' Create a default category for existing discounts '''
DiscountCategory = apps.get_model('discounts','DiscountCategory')
db_alias = schema_editor.connection.alias
DiscountCategory.objects.using(db_alias).create(
id=1,name='General Discounts',or... | python | def create_initial_category(apps, schema_editor):
''' Create a default category for existing discounts '''
DiscountCategory = apps.get_model('discounts','DiscountCategory')
db_alias = schema_editor.connection.alias
DiscountCategory.objects.using(db_alias).create(
id=1,name='General Discounts',or... | [
"def",
"create_initial_category",
"(",
"apps",
",",
"schema_editor",
")",
":",
"DiscountCategory",
"=",
"apps",
".",
"get_model",
"(",
"'discounts'",
",",
"'DiscountCategory'",
")",
"db_alias",
"=",
"schema_editor",
".",
"connection",
".",
"alias",
"DiscountCategory... | Create a default category for existing discounts | [
"Create",
"a",
"default",
"category",
"for",
"existing",
"discounts"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/discounts/migrations/0005_auto_20170830_1159.py#L10-L16 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.dispatch | def dispatch(self, request, *args, **kwargs):
'''
Check that registration is online before proceeding. If this is a POST
request, determine whether the response should be provided in JSON form.
'''
self.returnJson = (request.POST.get('json') in ['true', True])
regonline... | python | def dispatch(self, request, *args, **kwargs):
'''
Check that registration is online before proceeding. If this is a POST
request, determine whether the response should be provided in JSON form.
'''
self.returnJson = (request.POST.get('json') in ['true', True])
regonline... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"self",
".",
"returnJson",
"=",
"(",
"request",
".",
"POST",
".",
"get",
"(",
"'json'",
")",
"in",
"[",
"'true'",
",",
"True",
"]",
")",
"regonli... | Check that registration is online before proceeding. If this is a POST
request, determine whether the response should be provided in JSON form. | [
"Check",
"that",
"registration",
"is",
"online",
"before",
"proceeding",
".",
"If",
"this",
"is",
"a",
"POST",
"request",
"determine",
"whether",
"the",
"response",
"should",
"be",
"provided",
"in",
"JSON",
"form",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L65-L80 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.get_context_data | def get_context_data(self,**kwargs):
''' Add the event and series listing data '''
context = self.get_listing()
context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all'
context.update(kwargs)
# Update the site session data so that registration p... | python | def get_context_data(self,**kwargs):
''' Add the event and series listing data '''
context = self.get_listing()
context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all'
context.update(kwargs)
# Update the site session data so that registration p... | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"context",
"=",
"self",
".",
"get_listing",
"(",
")",
"context",
"[",
"'showDescriptionRule'",
"]",
"=",
"getConstant",
"(",
"'registration__showDescriptionRule'",
")",
"or",
"'all'",
"... | Add the event and series listing data | [
"Add",
"the",
"event",
"and",
"series",
"listing",
"data"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L82-L92 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.get_form_kwargs | def get_form_kwargs(self, **kwargs):
''' Tell the form which fields to render '''
kwargs = super(ClassRegistrationView, self).get_form_kwargs(**kwargs)
kwargs['user'] = self.request.user if hasattr(self.request,'user') else None
listing = self.get_listing()
kwargs.update({
... | python | def get_form_kwargs(self, **kwargs):
''' Tell the form which fields to render '''
kwargs = super(ClassRegistrationView, self).get_form_kwargs(**kwargs)
kwargs['user'] = self.request.user if hasattr(self.request,'user') else None
listing = self.get_listing()
kwargs.update({
... | [
"def",
"get_form_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"ClassRegistrationView",
",",
"self",
")",
".",
"get_form_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'user'",
"]",
"=",
"self",
".",
"req... | Tell the form which fields to render | [
"Tell",
"the",
"form",
"which",
"fields",
"to",
"render"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L94-L105 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.form_valid | def form_valid(self,form):
'''
If the form is valid, pass its contents on to the next view. In order to permit the registration
form to be overridden flexibly, but without permitting storage of arbitrary data keys that could
lead to potential security issues, a form class for this view ... | python | def form_valid(self,form):
'''
If the form is valid, pass its contents on to the next view. In order to permit the registration
form to be overridden flexibly, but without permitting storage of arbitrary data keys that could
lead to potential security issues, a form class for this view ... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"regSession",
"=",
"self",
".",
"request",
".",
"session",
".",
"get",
"(",
"REG_VALIDATION_STR",
",",
"{",
"}",
")",
"# The session expires after a period of inactivity that is specified in preferences.",
"expi... | If the form is valid, pass its contents on to the next view. In order to permit the registration
form to be overridden flexibly, but without permitting storage of arbitrary data keys that could
lead to potential security issues, a form class for this view can optionally specify a list of
keys t... | [
"If",
"the",
"form",
"is",
"valid",
"pass",
"its",
"contents",
"on",
"to",
"the",
"next",
"view",
".",
"In",
"order",
"to",
"permit",
"the",
"registration",
"form",
"to",
"be",
"overridden",
"flexibly",
"but",
"without",
"permitting",
"storage",
"of",
"arb... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L118-L223 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.get_allEvents | def get_allEvents(self):
'''
Splitting this method out to get the set of events to filter allows
one to subclass for different subsets of events without copying other
logic
'''
if not hasattr(self,'allEvents'):
timeFilters = {'endTime__gte': timezone.now()}
... | python | def get_allEvents(self):
'''
Splitting this method out to get the set of events to filter allows
one to subclass for different subsets of events without copying other
logic
'''
if not hasattr(self,'allEvents'):
timeFilters = {'endTime__gte': timezone.now()}
... | [
"def",
"get_allEvents",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'allEvents'",
")",
":",
"timeFilters",
"=",
"{",
"'endTime__gte'",
":",
"timezone",
".",
"now",
"(",
")",
"}",
"if",
"getConstant",
"(",
"'registration__displayLimitDay... | Splitting this method out to get the set of events to filter allows
one to subclass for different subsets of events without copying other
logic | [
"Splitting",
"this",
"method",
"out",
"to",
"get",
"the",
"set",
"of",
"events",
"to",
"filter",
"allows",
"one",
"to",
"subclass",
"for",
"different",
"subsets",
"of",
"events",
"without",
"copying",
"other",
"logic"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L228-L254 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | ClassRegistrationView.get_listing | def get_listing(self):
'''
This function gets all of the information that we need to either render or
validate the form. It is structured to avoid duplicate DB queries
'''
if not hasattr(self,'listing'):
allEvents = self.get_allEvents()
openEvents = allE... | python | def get_listing(self):
'''
This function gets all of the information that we need to either render or
validate the form. It is structured to avoid duplicate DB queries
'''
if not hasattr(self,'listing'):
allEvents = self.get_allEvents()
openEvents = allE... | [
"def",
"get_listing",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'listing'",
")",
":",
"allEvents",
"=",
"self",
".",
"get_allEvents",
"(",
")",
"openEvents",
"=",
"allEvents",
".",
"filter",
"(",
"registrationOpen",
"=",
"True",
"... | This function gets all of the information that we need to either render or
validate the form. It is structured to avoid duplicate DB queries | [
"This",
"function",
"gets",
"all",
"of",
"the",
"information",
"that",
"we",
"need",
"to",
"either",
"render",
"or",
"validate",
"the",
"form",
".",
"It",
"is",
"structured",
"to",
"avoid",
"duplicate",
"DB",
"queries"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L256-L295 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | RegistrationSummaryView.dispatch | def dispatch(self,request,*args,**kwargs):
''' Always check that the temporary registration has not expired '''
regSession = self.request.session.get(REG_VALIDATION_STR,{})
if not regSession:
return HttpResponseRedirect(reverse('registration'))
try:
reg = Tempor... | python | def dispatch(self,request,*args,**kwargs):
''' Always check that the temporary registration has not expired '''
regSession = self.request.session.get(REG_VALIDATION_STR,{})
if not regSession:
return HttpResponseRedirect(reverse('registration'))
try:
reg = Tempor... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"regSession",
"=",
"self",
".",
"request",
".",
"session",
".",
"get",
"(",
"REG_VALIDATION_STR",
",",
"{",
"}",
")",
"if",
"not",
"regSession",
":",... | Always check that the temporary registration has not expired | [
"Always",
"check",
"that",
"the",
"temporary",
"registration",
"has",
"not",
"expired"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L321-L347 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | RegistrationSummaryView.get_context_data | def get_context_data(self,**kwargs):
''' Pass the initial kwargs, then update with the needed registration info. '''
context_data = super(RegistrationSummaryView,self).get_context_data(**kwargs)
regSession = self.request.session[REG_VALIDATION_STR]
reg_id = regSession["temp_reg_id"]
... | python | def get_context_data(self,**kwargs):
''' Pass the initial kwargs, then update with the needed registration info. '''
context_data = super(RegistrationSummaryView,self).get_context_data(**kwargs)
regSession = self.request.session[REG_VALIDATION_STR]
reg_id = regSession["temp_reg_id"]
... | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"context_data",
"=",
"super",
"(",
"RegistrationSummaryView",
",",
"self",
")",
".",
"get_context_data",
"(",
"*",
"*",
"kwargs",
")",
"regSession",
"=",
"self",
".",
"request",
"."... | Pass the initial kwargs, then update with the needed registration info. | [
"Pass",
"the",
"initial",
"kwargs",
"then",
"update",
"with",
"the",
"needed",
"registration",
"info",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L440-L492 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | StudentInfoView.dispatch | def dispatch(self, request, *args, **kwargs):
'''
Require session data to be set to proceed, otherwise go back to step 1.
Because they have the same expiration date, this also implies that the
TemporaryRegistration object is not yet expired.
'''
if REG_VALIDATION_STR not ... | python | def dispatch(self, request, *args, **kwargs):
'''
Require session data to be set to proceed, otherwise go back to step 1.
Because they have the same expiration date, this also implies that the
TemporaryRegistration object is not yet expired.
'''
if REG_VALIDATION_STR not ... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"REG_VALIDATION_STR",
"not",
"in",
"request",
".",
"session",
":",
"return",
"HttpResponseRedirect",
"(",
"reverse",
"(",
"'registration'",
")",
")",... | Require session data to be set to proceed, otherwise go back to step 1.
Because they have the same expiration date, this also implies that the
TemporaryRegistration object is not yet expired. | [
"Require",
"session",
"data",
"to",
"be",
"set",
"to",
"proceed",
"otherwise",
"go",
"back",
"to",
"step",
"1",
".",
"Because",
"they",
"have",
"the",
"same",
"expiration",
"date",
"this",
"also",
"implies",
"that",
"the",
"TemporaryRegistration",
"object",
... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L557-L581 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | StudentInfoView.get_form_kwargs | def get_form_kwargs(self, **kwargs):
''' Pass along the request data to the form '''
kwargs = super(StudentInfoView, self).get_form_kwargs(**kwargs)
kwargs['request'] = self.request
kwargs['registration'] = self.temporaryRegistration
return kwargs | python | def get_form_kwargs(self, **kwargs):
''' Pass along the request data to the form '''
kwargs = super(StudentInfoView, self).get_form_kwargs(**kwargs)
kwargs['request'] = self.request
kwargs['registration'] = self.temporaryRegistration
return kwargs | [
"def",
"get_form_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"StudentInfoView",
",",
"self",
")",
".",
"get_form_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'request'",
"]",
"=",
"self",
".",
"reques... | Pass along the request data to the form | [
"Pass",
"along",
"the",
"request",
"data",
"to",
"the",
"form"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L656-L661 |
django-danceschool/django-danceschool | danceschool/core/classreg.py | StudentInfoView.form_valid | def form_valid(self,form):
'''
Even if this form is valid, the handlers for this form may have added messages
to the request. In that case, then the page should be handled as if the form
were invalid. Otherwise, update the session data with the form data and then
move to the ne... | python | def form_valid(self,form):
'''
Even if this form is valid, the handlers for this form may have added messages
to the request. In that case, then the page should be handled as if the form
were invalid. Otherwise, update the session data with the form data and then
move to the ne... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"reg",
"=",
"self",
".",
"temporaryRegistration",
"# The session expires after a period of inactivity that is specified in preferences.",
"expiry",
"=",
"timezone",
".",
"now",
"(",
")",
"+",
"timedelta",
"(",
"... | Even if this form is valid, the handlers for this form may have added messages
to the request. In that case, then the page should be handled as if the form
were invalid. Otherwise, update the session data with the form data and then
move to the next view | [
"Even",
"if",
"this",
"form",
"is",
"valid",
"the",
"handlers",
"for",
"this",
"form",
"may",
"have",
"added",
"messages",
"to",
"the",
"request",
".",
"In",
"that",
"case",
"then",
"the",
"page",
"should",
"be",
"handled",
"as",
"if",
"the",
"form",
"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L666-L699 |
django-danceschool/django-danceschool | danceschool/core/handlers.py | linkUserToMostRecentCustomer | def linkUserToMostRecentCustomer(sender,**kwargs):
'''
If a new primary email address has just been confirmed, check if the user
associated with that email has an associated customer object yet. If not,
then look for the customer with that email address who most recently
registered for something an... | python | def linkUserToMostRecentCustomer(sender,**kwargs):
'''
If a new primary email address has just been confirmed, check if the user
associated with that email has an associated customer object yet. If not,
then look for the customer with that email address who most recently
registered for something an... | [
"def",
"linkUserToMostRecentCustomer",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"email_address",
"=",
"kwargs",
".",
"get",
"(",
"'email_address'",
",",
"None",
")",
"if",
"not",
"email_address",
"or",
"not",
"email_address",
".",
"primary",
"or",
"... | If a new primary email address has just been confirmed, check if the user
associated with that email has an associated customer object yet. If not,
then look for the customer with that email address who most recently
registered for something and that is not associated with another user.
Automatically a... | [
"If",
"a",
"new",
"primary",
"email",
"address",
"has",
"just",
"been",
"confirmed",
"check",
"if",
"the",
"user",
"associated",
"with",
"that",
"email",
"has",
"an",
"associated",
"customer",
"object",
"yet",
".",
"If",
"not",
"then",
"look",
"for",
"the"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/handlers.py#L17-L51 |
django-danceschool/django-danceschool | danceschool/core/handlers.py | linkCustomerToVerifiedUser | def linkCustomerToVerifiedUser(sender, **kwargs):
"""
If a Registration is processed in which the associated Customer does not yet
have a User, then check to see if the Customer's email address has been
verified as belonging to a specific User, and if that User has an associated
Customer. If such a... | python | def linkCustomerToVerifiedUser(sender, **kwargs):
"""
If a Registration is processed in which the associated Customer does not yet
have a User, then check to see if the Customer's email address has been
verified as belonging to a specific User, and if that User has an associated
Customer. If such a... | [
"def",
"linkCustomerToVerifiedUser",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"registration",
"=",
"kwargs",
".",
"get",
"(",
"'registration'",
",",
"None",
")",
"if",
"not",
"registration",
"or",
"(",
"hasattr",
"(",
"registration",
".",
"customer"... | If a Registration is processed in which the associated Customer does not yet
have a User, then check to see if the Customer's email address has been
verified as belonging to a specific User, and if that User has an associated
Customer. If such a User is found, then associated this Customer with that
Us... | [
"If",
"a",
"Registration",
"is",
"processed",
"in",
"which",
"the",
"associated",
"Customer",
"does",
"not",
"yet",
"have",
"a",
"User",
"then",
"check",
"to",
"see",
"if",
"the",
"Customer",
"s",
"email",
"address",
"has",
"been",
"verified",
"as",
"belon... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/handlers.py#L55-L99 |
django-danceschool/django-danceschool | danceschool/core/autocomplete_light_registry.py | StaffMemberAutoComplete.create_object | def create_object(self, text):
''' Allow creation of staff members using a full name string. '''
if self.create_field == 'fullName':
firstName = text.split(' ')[0]
lastName = ' '.join(text.split(' ')[1:])
return self.get_queryset().create(**{'firstName': firstNam... | python | def create_object(self, text):
''' Allow creation of staff members using a full name string. '''
if self.create_field == 'fullName':
firstName = text.split(' ')[0]
lastName = ' '.join(text.split(' ')[1:])
return self.get_queryset().create(**{'firstName': firstNam... | [
"def",
"create_object",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"create_field",
"==",
"'fullName'",
":",
"firstName",
"=",
"text",
".",
"split",
"(",
"' '",
")",
"[",
"0",
"]",
"lastName",
"=",
"' '",
".",
"join",
"(",
"text",
".",
"... | Allow creation of staff members using a full name string. | [
"Allow",
"creation",
"of",
"staff",
"members",
"using",
"a",
"full",
"name",
"string",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/autocomplete_light_registry.py#L125-L132 |
django-danceschool/django-danceschool | danceschool/banlist/handlers.py | checkBanlist | def checkBanlist(sender, **kwargs):
'''
Check that this individual is not on the ban list.
'''
if not getConstant('registration__enableBanList'):
return
logger.debug('Signal to check RegistrationContactForm handled by banlist app.')
formData = kwargs.get('formData', {})
... | python | def checkBanlist(sender, **kwargs):
'''
Check that this individual is not on the ban list.
'''
if not getConstant('registration__enableBanList'):
return
logger.debug('Signal to check RegistrationContactForm handled by banlist app.')
formData = kwargs.get('formData', {})
... | [
"def",
"checkBanlist",
"(",
"sender",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"getConstant",
"(",
"'registration__enableBanList'",
")",
":",
"return",
"logger",
".",
"debug",
"(",
"'Signal to check RegistrationContactForm handled by banlist app.'",
")",
"formD... | Check that this individual is not on the ban list. | [
"Check",
"that",
"this",
"individual",
"is",
"not",
"on",
"the",
"ban",
"list",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/banlist/handlers.py#L35-L105 |
django-danceschool/django-danceschool | danceschool/financial/models.py | TransactionParty.clean | def clean(self):
'''
Verify that the user and staffMember are not mismatched.
Location can only be specified if user and staffMember are not.
'''
if self.staffMember and self.staffMember.userAccount and \
self.user and not self.staffMember.userAccount == self.user:
... | python | def clean(self):
'''
Verify that the user and staffMember are not mismatched.
Location can only be specified if user and staffMember are not.
'''
if self.staffMember and self.staffMember.userAccount and \
self.user and not self.staffMember.userAccount == self.user:
... | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"self",
".",
"staffMember",
"and",
"self",
".",
"staffMember",
".",
"userAccount",
"and",
"self",
".",
"user",
"and",
"not",
"self",
".",
"staffMember",
".",
"userAccount",
"==",
"self",
".",
"user",
":",
"r... | Verify that the user and staffMember are not mismatched.
Location can only be specified if user and staffMember are not. | [
"Verify",
"that",
"the",
"user",
"and",
"staffMember",
"are",
"not",
"mismatched",
".",
"Location",
"can",
"only",
"be",
"specified",
"if",
"user",
"and",
"staffMember",
"are",
"not",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L83-L94 |
django-danceschool/django-danceschool | danceschool/financial/models.py | TransactionParty.save | def save(self, updateBy=None, *args, **kwargs):
'''
Verify that the user and staffMember are populated with linked information, and
ensure that the name is properly specified.
'''
if (
self.staffMember and self.staffMember.userAccount and not self.user
) or (... | python | def save(self, updateBy=None, *args, **kwargs):
'''
Verify that the user and staffMember are populated with linked information, and
ensure that the name is properly specified.
'''
if (
self.staffMember and self.staffMember.userAccount and not self.user
) or (... | [
"def",
"save",
"(",
"self",
",",
"updateBy",
"=",
"None",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"(",
"self",
".",
"staffMember",
"and",
"self",
".",
"staffMember",
".",
"userAccount",
"and",
"not",
"self",
".",
"user",
")",
"or... | Verify that the user and staffMember are populated with linked information, and
ensure that the name is properly specified. | [
"Verify",
"that",
"the",
"user",
"and",
"staffMember",
"are",
"populated",
"with",
"linked",
"information",
"and",
"ensure",
"that",
"the",
"name",
"is",
"properly",
"specified",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L96-L124 |
django-danceschool/django-danceschool | danceschool/financial/models.py | RepeatedExpenseRule.timeAtThreshold | def timeAtThreshold(self,dateTime):
'''
A convenience method for checking when a time is on the start/end boundary
for this rule.
'''
# Anything that's not at a day boundary is for sure not at a threshold.
if not (
dateTime.hour == self.dayStarts and dateTime... | python | def timeAtThreshold(self,dateTime):
'''
A convenience method for checking when a time is on the start/end boundary
for this rule.
'''
# Anything that's not at a day boundary is for sure not at a threshold.
if not (
dateTime.hour == self.dayStarts and dateTime... | [
"def",
"timeAtThreshold",
"(",
"self",
",",
"dateTime",
")",
":",
"# Anything that's not at a day boundary is for sure not at a threshold.",
"if",
"not",
"(",
"dateTime",
".",
"hour",
"==",
"self",
".",
"dayStarts",
"and",
"dateTime",
".",
"minute",
"==",
"0",
"and"... | A convenience method for checking when a time is on the start/end boundary
for this rule. | [
"A",
"convenience",
"method",
"for",
"checking",
"when",
"a",
"time",
"is",
"on",
"the",
"start",
"/",
"end",
"boundary",
"for",
"this",
"rule",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L258-L279 |
django-danceschool/django-danceschool | danceschool/financial/models.py | RepeatedExpenseRule.ruleName | def ruleName(self):
''' This should be overridden for child classes '''
return '%s %s' % (self.rentalRate, self.RateRuleChoices.values.get(self.applyRateRule,self.applyRateRule)) | python | def ruleName(self):
''' This should be overridden for child classes '''
return '%s %s' % (self.rentalRate, self.RateRuleChoices.values.get(self.applyRateRule,self.applyRateRule)) | [
"def",
"ruleName",
"(",
"self",
")",
":",
"return",
"'%s %s'",
"%",
"(",
"self",
".",
"rentalRate",
",",
"self",
".",
"RateRuleChoices",
".",
"values",
".",
"get",
"(",
"self",
".",
"applyRateRule",
",",
"self",
".",
"applyRateRule",
")",
")"
] | This should be overridden for child classes | [
"This",
"should",
"be",
"overridden",
"for",
"child",
"classes"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L416-L418 |
django-danceschool/django-danceschool | danceschool/financial/models.py | RoomRentalInfo.ruleName | def ruleName(self):
''' overrides from parent class '''
return _('%s at %s' % (self.room.name, self.room.location.name)) | python | def ruleName(self):
''' overrides from parent class '''
return _('%s at %s' % (self.room.name, self.room.location.name)) | [
"def",
"ruleName",
"(",
"self",
")",
":",
"return",
"_",
"(",
"'%s at %s'",
"%",
"(",
"self",
".",
"room",
".",
"name",
",",
"self",
".",
"room",
".",
"location",
".",
"name",
")",
")"
] | overrides from parent class | [
"overrides",
"from",
"parent",
"class"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L469-L471 |
django-danceschool/django-danceschool | danceschool/financial/models.py | GenericRepeatedExpense.clean | def clean(self):
''' priorDays is required for Generic Repeated Expenses to avoid infinite loops '''
if not self.priorDays and not self.startDate:
raise ValidationError(_(
'Either a start date or an "up to __ days in the past" limit is required ' +
'for repeat... | python | def clean(self):
''' priorDays is required for Generic Repeated Expenses to avoid infinite loops '''
if not self.priorDays and not self.startDate:
raise ValidationError(_(
'Either a start date or an "up to __ days in the past" limit is required ' +
'for repeat... | [
"def",
"clean",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"priorDays",
"and",
"not",
"self",
".",
"startDate",
":",
"raise",
"ValidationError",
"(",
"_",
"(",
"'Either a start date or an \"up to __ days in the past\" limit is required '",
"+",
"'for repeated ex... | priorDays is required for Generic Repeated Expenses to avoid infinite loops | [
"priorDays",
"is",
"required",
"for",
"Generic",
"Repeated",
"Expenses",
"to",
"avoid",
"infinite",
"loops"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L585-L592 |
django-danceschool/django-danceschool | danceschool/financial/models.py | ExpenseItem.save | def save(self, *args, **kwargs):
'''
This custom save method ensures that an expense is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of expense of that series or event.
'''
# Set the approv... | python | def save(self, *args, **kwargs):
'''
This custom save method ensures that an expense is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of expense of that series or event.
'''
# Set the approv... | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the approval and payment dates if they have just been approved/paid.",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'__paid'",
")",
"or",
"not",
"hasattr",
"(",
"self",
",",
... | This custom save method ensures that an expense is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of expense of that series or event. | [
"This",
"custom",
"save",
"method",
"ensures",
"that",
"an",
"expense",
"is",
"not",
"attributed",
"to",
"multiple",
"categories",
".",
"It",
"also",
"ensures",
"that",
"the",
"series",
"and",
"event",
"properties",
"are",
"always",
"associated",
"with",
"any"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L724-L796 |
django-danceschool/django-danceschool | danceschool/financial/models.py | RevenueItem.relatedItems | def relatedItems(self):
'''
If this item is associated with a registration, then return all other items associated with
the same registration.
'''
if self.registration:
return self.registration.revenueitem_set.exclude(pk=self.pk) | python | def relatedItems(self):
'''
If this item is associated with a registration, then return all other items associated with
the same registration.
'''
if self.registration:
return self.registration.revenueitem_set.exclude(pk=self.pk) | [
"def",
"relatedItems",
"(",
"self",
")",
":",
"if",
"self",
".",
"registration",
":",
"return",
"self",
".",
"registration",
".",
"revenueitem_set",
".",
"exclude",
"(",
"pk",
"=",
"self",
".",
"pk",
")"
] | If this item is associated with a registration, then return all other items associated with
the same registration. | [
"If",
"this",
"item",
"is",
"associated",
"with",
"a",
"registration",
"then",
"return",
"all",
"other",
"items",
"associated",
"with",
"the",
"same",
"registration",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L874-L880 |
django-danceschool/django-danceschool | danceschool/financial/models.py | RevenueItem.save | def save(self, *args, **kwargs):
'''
This custom save method ensures that a revenue item is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of revenue of that series or event.
'''
# Set the r... | python | def save(self, *args, **kwargs):
'''
This custom save method ensures that a revenue item is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of revenue of that series or event.
'''
# Set the r... | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"# Set the received date if the payment was just marked received",
"if",
"not",
"hasattr",
"(",
"self",
",",
"'__received'",
")",
":",
"if",
"self",
".",
"received",
"and",
"not",... | This custom save method ensures that a revenue item is not attributed to multiple categories.
It also ensures that the series and event properties are always associated with any
type of revenue of that series or event. | [
"This",
"custom",
"save",
"method",
"ensures",
"that",
"a",
"revenue",
"item",
"is",
"not",
"attributed",
"to",
"multiple",
"categories",
".",
"It",
"also",
"ensures",
"that",
"the",
"series",
"and",
"event",
"properties",
"are",
"always",
"associated",
"with"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L891-L949 |
django-danceschool/django-danceschool | danceschool/private_lessons/forms.py | SlotCreationForm.clean | def clean(self):
'''
Only allow submission if there are not already slots in the submitted window,
and only allow rooms associated with the chosen location.
'''
super(SlotCreationForm,self).clean()
startDate = self.cleaned_data.get('startDate')
endDate ... | python | def clean(self):
'''
Only allow submission if there are not already slots in the submitted window,
and only allow rooms associated with the chosen location.
'''
super(SlotCreationForm,self).clean()
startDate = self.cleaned_data.get('startDate')
endDate ... | [
"def",
"clean",
"(",
"self",
")",
":",
"super",
"(",
"SlotCreationForm",
",",
"self",
")",
".",
"clean",
"(",
")",
"startDate",
"=",
"self",
".",
"cleaned_data",
".",
"get",
"(",
"'startDate'",
")",
"endDate",
"=",
"self",
".",
"cleaned_data",
".",
"ge... | Only allow submission if there are not already slots in the submitted window,
and only allow rooms associated with the chosen location. | [
"Only",
"allow",
"submission",
"if",
"there",
"are",
"not",
"already",
"slots",
"in",
"the",
"submitted",
"window",
"and",
"only",
"allow",
"rooms",
"associated",
"with",
"the",
"chosen",
"location",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/forms.py#L70-L94 |
django-danceschool/django-danceschool | danceschool/financial/autocomplete_light_registry.py | get_method_list | def get_method_list():
'''
Include manual methods by default
'''
methods = [str(_('Cash')),str(_('Check')),str(_('Bank/Debit Card')),str(_('Other'))]
methods += ExpenseItem.objects.order_by().values_list('paymentMethod',flat=True).distinct()
methods += RevenueItem.objects.order_by().values... | python | def get_method_list():
'''
Include manual methods by default
'''
methods = [str(_('Cash')),str(_('Check')),str(_('Bank/Debit Card')),str(_('Other'))]
methods += ExpenseItem.objects.order_by().values_list('paymentMethod',flat=True).distinct()
methods += RevenueItem.objects.order_by().values... | [
"def",
"get_method_list",
"(",
")",
":",
"methods",
"=",
"[",
"str",
"(",
"_",
"(",
"'Cash'",
")",
")",
",",
"str",
"(",
"_",
"(",
"'Check'",
")",
")",
",",
"str",
"(",
"_",
"(",
"'Bank/Debit Card'",
")",
")",
",",
"str",
"(",
"_",
"(",
"'Other... | Include manual methods by default | [
"Include",
"manual",
"methods",
"by",
"default"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L11-L23 |
django-danceschool/django-danceschool | danceschool/financial/autocomplete_light_registry.py | TransactionPartyAutoComplete.get_create_option | def get_create_option(self, context, q):
"""Form the correct create_option to append to results."""
create_option = []
display_create_option = False
if self.create_field and q:
page_obj = context.get('page_obj', None)
if page_obj is None or page_obj.number =... | python | def get_create_option(self, context, q):
"""Form the correct create_option to append to results."""
create_option = []
display_create_option = False
if self.create_field and q:
page_obj = context.get('page_obj', None)
if page_obj is None or page_obj.number =... | [
"def",
"get_create_option",
"(",
"self",
",",
"context",
",",
"q",
")",
":",
"create_option",
"=",
"[",
"]",
"display_create_option",
"=",
"False",
"if",
"self",
".",
"create_field",
"and",
"q",
":",
"page_obj",
"=",
"context",
".",
"get",
"(",
"'page_obj'... | Form the correct create_option to append to results. | [
"Form",
"the",
"correct",
"create_option",
"to",
"append",
"to",
"results",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L80-L135 |
django-danceschool/django-danceschool | danceschool/financial/autocomplete_light_registry.py | TransactionPartyAutoComplete.create_object | def create_object(self, text):
''' Allow creation of transaction parties using a full name string. '''
if self.create_field == 'name':
if text.startswith('Location_'):
this_id = text[len('Location_'):]
this_loc = Location.objects.get(id=this_id)
... | python | def create_object(self, text):
''' Allow creation of transaction parties using a full name string. '''
if self.create_field == 'name':
if text.startswith('Location_'):
this_id = text[len('Location_'):]
this_loc = Location.objects.get(id=this_id)
... | [
"def",
"create_object",
"(",
"self",
",",
"text",
")",
":",
"if",
"self",
".",
"create_field",
"==",
"'name'",
":",
"if",
"text",
".",
"startswith",
"(",
"'Location_'",
")",
":",
"this_id",
"=",
"text",
"[",
"len",
"(",
"'Location_'",
")",
":",
"]",
... | Allow creation of transaction parties using a full name string. | [
"Allow",
"creation",
"of",
"transaction",
"parties",
"using",
"a",
"full",
"name",
"string",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L137-L166 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | has_group | def has_group(user, group_name):
'''
This allows specification group-based permissions in templates.
In most instances, creating model-based permissions and giving
them to the desired group is preferable.
'''
if user.groups.filter(name=group_name).exists():
return True
return... | python | def has_group(user, group_name):
'''
This allows specification group-based permissions in templates.
In most instances, creating model-based permissions and giving
them to the desired group is preferable.
'''
if user.groups.filter(name=group_name).exists():
return True
return... | [
"def",
"has_group",
"(",
"user",
",",
"group_name",
")",
":",
"if",
"user",
".",
"groups",
".",
"filter",
"(",
"name",
"=",
"group_name",
")",
".",
"exists",
"(",
")",
":",
"return",
"True",
"return",
"False"
] | This allows specification group-based permissions in templates.
In most instances, creating model-based permissions and giving
them to the desired group is preferable. | [
"This",
"allows",
"specification",
"group",
"-",
"based",
"permissions",
"in",
"templates",
".",
"In",
"most",
"instances",
"creating",
"model",
"-",
"based",
"permissions",
"and",
"giving",
"them",
"to",
"the",
"desired",
"group",
"is",
"preferable",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L53-L61 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | get_item_by_key | def get_item_by_key(passed_list, key, value):
'''
This one allows us to get one or more items from a list of
dictionaries based on the value of a specified key, where
both the key and the value can be variable names. Does
not work with None or null string passed values.
'''
if valu... | python | def get_item_by_key(passed_list, key, value):
'''
This one allows us to get one or more items from a list of
dictionaries based on the value of a specified key, where
both the key and the value can be variable names. Does
not work with None or null string passed values.
'''
if valu... | [
"def",
"get_item_by_key",
"(",
"passed_list",
",",
"key",
",",
"value",
")",
":",
"if",
"value",
"in",
"[",
"None",
",",
"''",
"]",
":",
"return",
"if",
"type",
"(",
"passed_list",
")",
"in",
"[",
"QuerySet",
",",
"PolymorphicQuerySet",
"]",
":",
"sub_... | This one allows us to get one or more items from a list of
dictionaries based on the value of a specified key, where
both the key and the value can be variable names. Does
not work with None or null string passed values. | [
"This",
"one",
"allows",
"us",
"to",
"get",
"one",
"or",
"more",
"items",
"from",
"a",
"list",
"of",
"dictionaries",
"based",
"on",
"the",
"value",
"of",
"a",
"specified",
"key",
"where",
"both",
"the",
"key",
"and",
"the",
"value",
"can",
"be",
"varia... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L74-L92 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | get_field_for_object | def get_field_for_object(field_type, field_id, form):
'''
This tag allows one to get a specific series or event form field
in registration views.
'''
field_name = field_type + '_' + str(field_id)
return form.__getitem__(field_name) | python | def get_field_for_object(field_type, field_id, form):
'''
This tag allows one to get a specific series or event form field
in registration views.
'''
field_name = field_type + '_' + str(field_id)
return form.__getitem__(field_name) | [
"def",
"get_field_for_object",
"(",
"field_type",
",",
"field_id",
",",
"form",
")",
":",
"field_name",
"=",
"field_type",
"+",
"'_'",
"+",
"str",
"(",
"field_id",
")",
"return",
"form",
".",
"__getitem__",
"(",
"field_name",
")"
] | This tag allows one to get a specific series or event form field
in registration views. | [
"This",
"tag",
"allows",
"one",
"to",
"get",
"a",
"specific",
"series",
"or",
"event",
"form",
"field",
"in",
"registration",
"views",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L96-L102 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | template_exists | def template_exists(template_name):
'''
Determine if a given template exists so that it can be loaded
if so, or a default alternative can be used if not.
'''
try:
template.loader.get_template(template_name)
return True
except template.TemplateDoesNotExist:
return... | python | def template_exists(template_name):
'''
Determine if a given template exists so that it can be loaded
if so, or a default alternative can be used if not.
'''
try:
template.loader.get_template(template_name)
return True
except template.TemplateDoesNotExist:
return... | [
"def",
"template_exists",
"(",
"template_name",
")",
":",
"try",
":",
"template",
".",
"loader",
".",
"get_template",
"(",
"template_name",
")",
"return",
"True",
"except",
"template",
".",
"TemplateDoesNotExist",
":",
"return",
"False"
] | Determine if a given template exists so that it can be loaded
if so, or a default alternative can be used if not. | [
"Determine",
"if",
"a",
"given",
"template",
"exists",
"so",
"that",
"it",
"can",
"be",
"loaded",
"if",
"so",
"or",
"a",
"default",
"alternative",
"can",
"be",
"used",
"if",
"not",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L106-L115 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | numRegisteredForRole | def numRegisteredForRole(event, role):
'''
This tag allows one to access the number of registrations
for any dance role.
'''
if not isinstance(event, Event) or not isinstance(role, DanceRole):
return None
return event.numRegisteredForRole(role) | python | def numRegisteredForRole(event, role):
'''
This tag allows one to access the number of registrations
for any dance role.
'''
if not isinstance(event, Event) or not isinstance(role, DanceRole):
return None
return event.numRegisteredForRole(role) | [
"def",
"numRegisteredForRole",
"(",
"event",
",",
"role",
")",
":",
"if",
"not",
"isinstance",
"(",
"event",
",",
"Event",
")",
"or",
"not",
"isinstance",
"(",
"role",
",",
"DanceRole",
")",
":",
"return",
"None",
"return",
"event",
".",
"numRegisteredForR... | This tag allows one to access the number of registrations
for any dance role. | [
"This",
"tag",
"allows",
"one",
"to",
"access",
"the",
"number",
"of",
"registrations",
"for",
"any",
"dance",
"role",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L119-L126 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | soldOutForRole | def soldOutForRole(event, role):
'''
This tag allows one to determine whether any event is sold out for any
particular role.
'''
if not isinstance(event, Event) or not isinstance(role, DanceRole):
return None
return event.soldOutForRole(role) | python | def soldOutForRole(event, role):
'''
This tag allows one to determine whether any event is sold out for any
particular role.
'''
if not isinstance(event, Event) or not isinstance(role, DanceRole):
return None
return event.soldOutForRole(role) | [
"def",
"soldOutForRole",
"(",
"event",
",",
"role",
")",
":",
"if",
"not",
"isinstance",
"(",
"event",
",",
"Event",
")",
"or",
"not",
"isinstance",
"(",
"role",
",",
"DanceRole",
")",
":",
"return",
"None",
"return",
"event",
".",
"soldOutForRole",
"(",... | This tag allows one to determine whether any event is sold out for any
particular role. | [
"This",
"tag",
"allows",
"one",
"to",
"determine",
"whether",
"any",
"event",
"is",
"sold",
"out",
"for",
"any",
"particular",
"role",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L130-L137 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | numRegisteredForRoleName | def numRegisteredForRoleName(event, roleName):
'''
This tag allows one to access the number of registrations
for any dance role using only the role's name.
'''
if not isinstance(event, Event):
return None
try:
role = DanceRole.objects.get(name=roleName)
except Obje... | python | def numRegisteredForRoleName(event, roleName):
'''
This tag allows one to access the number of registrations
for any dance role using only the role's name.
'''
if not isinstance(event, Event):
return None
try:
role = DanceRole.objects.get(name=roleName)
except Obje... | [
"def",
"numRegisteredForRoleName",
"(",
"event",
",",
"roleName",
")",
":",
"if",
"not",
"isinstance",
"(",
"event",
",",
"Event",
")",
":",
"return",
"None",
"try",
":",
"role",
"=",
"DanceRole",
".",
"objects",
".",
"get",
"(",
"name",
"=",
"roleName",... | This tag allows one to access the number of registrations
for any dance role using only the role's name. | [
"This",
"tag",
"allows",
"one",
"to",
"access",
"the",
"number",
"of",
"registrations",
"for",
"any",
"dance",
"role",
"using",
"only",
"the",
"role",
"s",
"name",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L141-L154 |
django-danceschool/django-danceschool | danceschool/core/templatetags/danceschool_tags.py | getReturnPage | def getReturnPage(context, prior=False):
'''
This tag makes it easy to get return links from within a template without
requiring custom logic inside the view. Just include
{% getReturnPage as returnPage %} and then reference {{ returnPage.url }}
and {{ returnPage.title }} as needed.
'''
... | python | def getReturnPage(context, prior=False):
'''
This tag makes it easy to get return links from within a template without
requiring custom logic inside the view. Just include
{% getReturnPage as returnPage %} and then reference {{ returnPage.url }}
and {{ returnPage.title }} as needed.
'''
... | [
"def",
"getReturnPage",
"(",
"context",
",",
"prior",
"=",
"False",
")",
":",
"siteHistory",
"=",
"getattr",
"(",
"context",
".",
"get",
"(",
"'request'",
",",
"None",
")",
",",
"'session'",
",",
"{",
"}",
")",
".",
"get",
"(",
"'SITE_HISTORY'",
",",
... | This tag makes it easy to get return links from within a template without
requiring custom logic inside the view. Just include
{% getReturnPage as returnPage %} and then reference {{ returnPage.url }}
and {{ returnPage.title }} as needed. | [
"This",
"tag",
"makes",
"it",
"easy",
"to",
"get",
"return",
"links",
"from",
"within",
"a",
"template",
"without",
"requiring",
"custom",
"logic",
"inside",
"the",
"view",
".",
"Just",
"include",
"{",
"%",
"getReturnPage",
"as",
"returnPage",
"%",
"}",
"a... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L164-L172 |
django-danceschool/django-danceschool | danceschool/vouchers/models.py | Voucher.create_new_code | def create_new_code(cls,**kwargs):
'''
Creates a new Voucher with a unique voucherId
'''
prefix = kwargs.pop('prefix','')
new = False
while not new:
# Standard is a ten-letter random string of uppercase letters
random_string = ''.join(random.choic... | python | def create_new_code(cls,**kwargs):
'''
Creates a new Voucher with a unique voucherId
'''
prefix = kwargs.pop('prefix','')
new = False
while not new:
# Standard is a ten-letter random string of uppercase letters
random_string = ''.join(random.choic... | [
"def",
"create_new_code",
"(",
"cls",
",",
"*",
"*",
"kwargs",
")",
":",
"prefix",
"=",
"kwargs",
".",
"pop",
"(",
"'prefix'",
",",
"''",
")",
"new",
"=",
"False",
"while",
"not",
"new",
":",
"# Standard is a ten-letter random string of uppercase letters",
"ra... | Creates a new Voucher with a unique voucherId | [
"Creates",
"a",
"new",
"Voucher",
"with",
"a",
"unique",
"voucherId"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/models.py#L66-L79 |
django-danceschool/django-danceschool | danceschool/guestlist/ajax.py | getGuestList | def getGuestList(request):
'''
This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form.
'''
if not (
request.method == 'POST' and
request.POST.get('guestlist_id') and
request.POST.get('event_id... | python | def getGuestList(request):
'''
This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form.
'''
if not (
request.method == 'POST' and
request.POST.get('guestlist_id') and
request.POST.get('event_id... | [
"def",
"getGuestList",
"(",
"request",
")",
":",
"if",
"not",
"(",
"request",
".",
"method",
"==",
"'POST'",
"and",
"request",
".",
"POST",
".",
"get",
"(",
"'guestlist_id'",
")",
"and",
"request",
".",
"POST",
".",
"get",
"(",
"'event_id'",
")",
"and"... | This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form. | [
"This",
"function",
"handles",
"the",
"filtering",
"of",
"available",
"eventregistration",
"-",
"related",
"invoice",
"items",
"and",
"is",
"used",
"on",
"the",
"revenue",
"reporting",
"form",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/ajax.py#L8-L30 |
django-danceschool/django-danceschool | danceschool/payments/payatdoor/cms_plugins.py | PayAtDoorFormPlugin.render | def render(self, context, instance, placeholder):
''' Add the cart-specific context to this form '''
context = super(PayAtDoorFormPlugin, self).render(context, instance, placeholder)
context.update({
'business_name': getConstant('contact__businessName'),
'currencyCode': ... | python | def render(self, context, instance, placeholder):
''' Add the cart-specific context to this form '''
context = super(PayAtDoorFormPlugin, self).render(context, instance, placeholder)
context.update({
'business_name': getConstant('contact__businessName'),
'currencyCode': ... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"PayAtDoorFormPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"context",
".",
"... | Add the cart-specific context to this form | [
"Add",
"the",
"cart",
"-",
"specific",
"context",
"to",
"this",
"form"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/payatdoor/cms_plugins.py#L19-L29 |
django-danceschool/django-danceschool | danceschool/prerequisites/models.py | Requirement.customerMeetsRequirement | def customerMeetsRequirement(self, customer, danceRole=None, registration=None):
'''
This method checks whether a given customer meets a given set of requirements.
'''
cust_reqs = self.customerrequirement_set.filter(customer=customer,met=True)
if customer:
cust_prior... | python | def customerMeetsRequirement(self, customer, danceRole=None, registration=None):
'''
This method checks whether a given customer meets a given set of requirements.
'''
cust_reqs = self.customerrequirement_set.filter(customer=customer,met=True)
if customer:
cust_prior... | [
"def",
"customerMeetsRequirement",
"(",
"self",
",",
"customer",
",",
"danceRole",
"=",
"None",
",",
"registration",
"=",
"None",
")",
":",
"cust_reqs",
"=",
"self",
".",
"customerrequirement_set",
".",
"filter",
"(",
"customer",
"=",
"customer",
",",
"met",
... | This method checks whether a given customer meets a given set of requirements. | [
"This",
"method",
"checks",
"whether",
"a",
"given",
"customer",
"meets",
"a",
"given",
"set",
"of",
"requirements",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/prerequisites/models.py#L49-L129 |
django-danceschool/django-danceschool | danceschool/financial/handlers.py | updateTransactionParty | def updateTransactionParty(sender,instance,**kwargs):
'''
If a User, StaffMember, or Location is updated, and there exists an associated
TransactionParty, then the name and other attributes of that party should be updated
to reflect the new information.
'''
if 'loaddata' in sys.argv or (... | python | def updateTransactionParty(sender,instance,**kwargs):
'''
If a User, StaffMember, or Location is updated, and there exists an associated
TransactionParty, then the name and other attributes of that party should be updated
to reflect the new information.
'''
if 'loaddata' in sys.argv or (... | [
"def",
"updateTransactionParty",
"(",
"sender",
",",
"instance",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"'loaddata'",
"in",
"sys",
".",
"argv",
"or",
"(",
"'raw'",
"in",
"kwargs",
"and",
"kwargs",
"[",
"'raw'",
"]",
")",
":",
"return",
"logger",
".",... | If a User, StaffMember, or Location is updated, and there exists an associated
TransactionParty, then the name and other attributes of that party should be updated
to reflect the new information. | [
"If",
"a",
"User",
"StaffMember",
"or",
"Location",
"is",
"updated",
"and",
"there",
"exists",
"an",
"associated",
"TransactionParty",
"then",
"the",
"name",
"and",
"other",
"attributes",
"of",
"that",
"party",
"should",
"be",
"updated",
"to",
"reflect",
"the"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/handlers.py#L151-L165 |
django-danceschool/django-danceschool | danceschool/payments/square/tasks.py | updateSquareFees | def updateSquareFees(paymentRecord):
'''
The Square Checkout API does not calculate fees immediately, so this task is
called to be asynchronously run 1 minute after the initial transaction, so that
any Invoice or ExpenseItem associated with this transaction also remains accurate.
'''
fee... | python | def updateSquareFees(paymentRecord):
'''
The Square Checkout API does not calculate fees immediately, so this task is
called to be asynchronously run 1 minute after the initial transaction, so that
any Invoice or ExpenseItem associated with this transaction also remains accurate.
'''
fee... | [
"def",
"updateSquareFees",
"(",
"paymentRecord",
")",
":",
"fees",
"=",
"paymentRecord",
".",
"netFees",
"invoice",
"=",
"paymentRecord",
".",
"invoice",
"invoice",
".",
"fees",
"=",
"fees",
"invoice",
".",
"save",
"(",
")",
"invoice",
".",
"allocateFees",
"... | The Square Checkout API does not calculate fees immediately, so this task is
called to be asynchronously run 1 minute after the initial transaction, so that
any Invoice or ExpenseItem associated with this transaction also remains accurate. | [
"The",
"Square",
"Checkout",
"API",
"does",
"not",
"calculate",
"fees",
"immediately",
"so",
"this",
"task",
"is",
"called",
"to",
"be",
"asynchronously",
"run",
"1",
"minute",
"after",
"the",
"initial",
"transaction",
"so",
"that",
"any",
"Invoice",
"or",
"... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/square/tasks.py#L5-L17 |
django-danceschool/django-danceschool | danceschool/stats/stats.py | getClassTypeMonthlyData | def getClassTypeMonthlyData(year=None, series=None, typeLimit=None):
'''
To break out by class type and month simultaneously, get data for each
series and aggregate by class type.
'''
# If no year specified, report current year to date.
if not year:
year = timezone.now().year
role_... | python | def getClassTypeMonthlyData(year=None, series=None, typeLimit=None):
'''
To break out by class type and month simultaneously, get data for each
series and aggregate by class type.
'''
# If no year specified, report current year to date.
if not year:
year = timezone.now().year
role_... | [
"def",
"getClassTypeMonthlyData",
"(",
"year",
"=",
"None",
",",
"series",
"=",
"None",
",",
"typeLimit",
"=",
"None",
")",
":",
"# If no year specified, report current year to date.",
"if",
"not",
"year",
":",
"year",
"=",
"timezone",
".",
"now",
"(",
")",
".... | To break out by class type and month simultaneously, get data for each
series and aggregate by class type. | [
"To",
"break",
"out",
"by",
"class",
"type",
"and",
"month",
"simultaneously",
"get",
"data",
"for",
"each",
"series",
"and",
"aggregate",
"by",
"class",
"type",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/stats.py#L138-L211 |
django-danceschool/django-danceschool | danceschool/stats/stats.py | getMonthlyPerformance | def getMonthlyPerformance():
'''
This function does the work of compiling monthly performance data
that can either be rendered as CSV or as JSON
'''
when_all = {
'eventregistration__dropIn': False,
'eventregistration__cancelled': False,
}
# Get objects at the Series level so... | python | def getMonthlyPerformance():
'''
This function does the work of compiling monthly performance data
that can either be rendered as CSV or as JSON
'''
when_all = {
'eventregistration__dropIn': False,
'eventregistration__cancelled': False,
}
# Get objects at the Series level so... | [
"def",
"getMonthlyPerformance",
"(",
")",
":",
"when_all",
"=",
"{",
"'eventregistration__dropIn'",
":",
"False",
",",
"'eventregistration__cancelled'",
":",
"False",
",",
"}",
"# Get objects at the Series level so that we can calculate StudentHours",
"series_counts",
"=",
"l... | This function does the work of compiling monthly performance data
that can either be rendered as CSV or as JSON | [
"This",
"function",
"does",
"the",
"work",
"of",
"compiling",
"monthly",
"performance",
"data",
"that",
"can",
"either",
"be",
"rendered",
"as",
"CSV",
"or",
"as",
"JSON"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/stats.py#L376-L451 |
django-danceschool/django-danceschool | danceschool/stats/stats.py | getRegistrationReferralCounts | def getRegistrationReferralCounts(startDate,endDate):
'''
When a user accesses the class registration page through a
referral URL, the marketing_id gets saved in the extra JSON
data associated with that registration. This just returns
counts associated with how often given referral terms appear
... | python | def getRegistrationReferralCounts(startDate,endDate):
'''
When a user accesses the class registration page through a
referral URL, the marketing_id gets saved in the extra JSON
data associated with that registration. This just returns
counts associated with how often given referral terms appear
... | [
"def",
"getRegistrationReferralCounts",
"(",
"startDate",
",",
"endDate",
")",
":",
"timeFilters",
"=",
"{",
"}",
"if",
"startDate",
":",
"timeFilters",
"[",
"'dateTime__gte'",
"]",
"=",
"startDate",
"if",
"endDate",
":",
"timeFilters",
"[",
"'dateTime__lt'",
"]... | When a user accesses the class registration page through a
referral URL, the marketing_id gets saved in the extra JSON
data associated with that registration. This just returns
counts associated with how often given referral terms appear
in a specified time window (i.e. how many people signed up
by... | [
"When",
"a",
"user",
"accesses",
"the",
"class",
"registration",
"page",
"through",
"a",
"referral",
"URL",
"the",
"marketing_id",
"gets",
"saved",
"in",
"the",
"extra",
"JSON",
"data",
"associated",
"with",
"that",
"registration",
".",
"This",
"just",
"return... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/stats.py#L618-L638 |
django-danceschool/django-danceschool | danceschool/private_lessons/views.py | AddAvailabilitySlotView.form_valid | def form_valid(self, form):
'''
Create slots and return success message.
'''
startDate = form.cleaned_data['startDate']
endDate = form.cleaned_data['endDate']
startTime = form.cleaned_data['startTime']
endTime = form.cleaned_data['endTime']
instructor = fo... | python | def form_valid(self, form):
'''
Create slots and return success message.
'''
startDate = form.cleaned_data['startDate']
endDate = form.cleaned_data['endDate']
startTime = form.cleaned_data['startTime']
endTime = form.cleaned_data['endTime']
instructor = fo... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"startDate",
"=",
"form",
".",
"cleaned_data",
"[",
"'startDate'",
"]",
"endDate",
"=",
"form",
".",
"cleaned_data",
"[",
"'endDate'",
"]",
"startTime",
"=",
"form",
".",
"cleaned_data",
"[",
"'start... | Create slots and return success message. | [
"Create",
"slots",
"and",
"return",
"success",
"message",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L61-L88 |
django-danceschool/django-danceschool | danceschool/private_lessons/views.py | UpdateAvailabilitySlotView.form_valid | def form_valid(self, form):
'''
Modify or delete the availability slot as requested and return success message.
'''
slotIds = form.cleaned_data['slotIds']
deleteSlot = form.cleaned_data.get('deleteSlot', False)
these_slots = InstructorAvailabilitySlot.objects.filter(id__... | python | def form_valid(self, form):
'''
Modify or delete the availability slot as requested and return success message.
'''
slotIds = form.cleaned_data['slotIds']
deleteSlot = form.cleaned_data.get('deleteSlot', False)
these_slots = InstructorAvailabilitySlot.objects.filter(id__... | [
"def",
"form_valid",
"(",
"self",
",",
"form",
")",
":",
"slotIds",
"=",
"form",
".",
"cleaned_data",
"[",
"'slotIds'",
"]",
"deleteSlot",
"=",
"form",
".",
"cleaned_data",
".",
"get",
"(",
"'deleteSlot'",
",",
"False",
")",
"these_slots",
"=",
"Instructor... | Modify or delete the availability slot as requested and return success message. | [
"Modify",
"or",
"delete",
"the",
"availability",
"slot",
"as",
"requested",
"and",
"return",
"success",
"message",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L101-L120 |
django-danceschool/django-danceschool | danceschool/private_lessons/views.py | BookPrivateLessonView.get_form_kwargs | def get_form_kwargs(self, **kwargs):
'''
Pass the current user to the form to render the payAtDoor field if applicable.
'''
kwargs = super(BookPrivateLessonView, self).get_form_kwargs(**kwargs)
kwargs['user'] = self.request.user if hasattr(self.request,'user') else None
r... | python | def get_form_kwargs(self, **kwargs):
'''
Pass the current user to the form to render the payAtDoor field if applicable.
'''
kwargs = super(BookPrivateLessonView, self).get_form_kwargs(**kwargs)
kwargs['user'] = self.request.user if hasattr(self.request,'user') else None
r... | [
"def",
"get_form_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"BookPrivateLessonView",
",",
"self",
")",
".",
"get_form_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'user'",
"]",
"=",
"self",
".",
"req... | Pass the current user to the form to render the payAtDoor field if applicable. | [
"Pass",
"the",
"current",
"user",
"to",
"the",
"form",
"to",
"render",
"the",
"payAtDoor",
"field",
"if",
"applicable",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L137-L143 |
django-danceschool/django-danceschool | danceschool/private_lessons/views.py | PrivateLessonStudentInfoView.dispatch | def dispatch(self,request,*args,**kwargs):
'''
Handle the session data passed by the prior view.
'''
lessonSession = request.session.get(PRIVATELESSON_VALIDATION_STR,{})
try:
self.lesson = PrivateLessonEvent.objects.get(id=lessonSession.get('lesson'))
except... | python | def dispatch(self,request,*args,**kwargs):
'''
Handle the session data passed by the prior view.
'''
lessonSession = request.session.get(PRIVATELESSON_VALIDATION_STR,{})
try:
self.lesson = PrivateLessonEvent.objects.get(id=lessonSession.get('lesson'))
except... | [
"def",
"dispatch",
"(",
"self",
",",
"request",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"lessonSession",
"=",
"request",
".",
"session",
".",
"get",
"(",
"PRIVATELESSON_VALIDATION_STR",
",",
"{",
"}",
")",
"try",
":",
"self",
".",
"lesson"... | Handle the session data passed by the prior view. | [
"Handle",
"the",
"session",
"data",
"passed",
"by",
"the",
"prior",
"view",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L308-L327 |
django-danceschool/django-danceschool | danceschool/private_lessons/views.py | PrivateLessonStudentInfoView.get_form_kwargs | def get_form_kwargs(self, **kwargs):
''' Pass along the request data to the form '''
kwargs = super(PrivateLessonStudentInfoView, self).get_form_kwargs(**kwargs)
kwargs['request'] = self.request
kwargs['payAtDoor'] = self.payAtDoor
return kwargs | python | def get_form_kwargs(self, **kwargs):
''' Pass along the request data to the form '''
kwargs = super(PrivateLessonStudentInfoView, self).get_form_kwargs(**kwargs)
kwargs['request'] = self.request
kwargs['payAtDoor'] = self.payAtDoor
return kwargs | [
"def",
"get_form_kwargs",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"kwargs",
"=",
"super",
"(",
"PrivateLessonStudentInfoView",
",",
"self",
")",
".",
"get_form_kwargs",
"(",
"*",
"*",
"kwargs",
")",
"kwargs",
"[",
"'request'",
"]",
"=",
"self",
"... | Pass along the request data to the form | [
"Pass",
"along",
"the",
"request",
"data",
"to",
"the",
"form"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L337-L342 |
django-danceschool/django-danceschool | danceschool/financial/ajax.py | updateEventRegistrations | def updateEventRegistrations(request):
'''
This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form.
'''
if not (request.method == 'POST' and request.POST.get('event')):
return JsonResponse({})
invoiceItem... | python | def updateEventRegistrations(request):
'''
This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form.
'''
if not (request.method == 'POST' and request.POST.get('event')):
return JsonResponse({})
invoiceItem... | [
"def",
"updateEventRegistrations",
"(",
"request",
")",
":",
"if",
"not",
"(",
"request",
".",
"method",
"==",
"'POST'",
"and",
"request",
".",
"POST",
".",
"get",
"(",
"'event'",
")",
")",
":",
"return",
"JsonResponse",
"(",
"{",
"}",
")",
"invoiceItems... | This function handles the filtering of available eventregistration-related
invoice items and is used on the revenue reporting form. | [
"This",
"function",
"handles",
"the",
"filtering",
"of",
"available",
"eventregistration",
"-",
"related",
"invoice",
"items",
"and",
"is",
"used",
"on",
"the",
"revenue",
"reporting",
"form",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/ajax.py#L5-L21 |
django-danceschool/django-danceschool | danceschool/guestlist/views.py | GuestListView.get_object | def get_object(self, queryset=None):
''' Get the guest list from the URL '''
return get_object_or_404(
GuestList.objects.filter(id=self.kwargs.get('guestlist_id'))) | python | def get_object(self, queryset=None):
''' Get the guest list from the URL '''
return get_object_or_404(
GuestList.objects.filter(id=self.kwargs.get('guestlist_id'))) | [
"def",
"get_object",
"(",
"self",
",",
"queryset",
"=",
"None",
")",
":",
"return",
"get_object_or_404",
"(",
"GuestList",
".",
"objects",
".",
"filter",
"(",
"id",
"=",
"self",
".",
"kwargs",
".",
"get",
"(",
"'guestlist_id'",
")",
")",
")"
] | Get the guest list from the URL | [
"Get",
"the",
"guest",
"list",
"from",
"the",
"URL"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/views.py#L18-L21 |
django-danceschool/django-danceschool | danceschool/guestlist/views.py | GuestListView.get_context_data | def get_context_data(self,**kwargs):
''' Add the list of names for the given guest list '''
event = Event.objects.filter(id=self.kwargs.get('event_id')).first()
if self.kwargs.get('event_id') and not self.object.appliesToEvent(event):
raise Http404(_('Invalid event.'))
... | python | def get_context_data(self,**kwargs):
''' Add the list of names for the given guest list '''
event = Event.objects.filter(id=self.kwargs.get('event_id')).first()
if self.kwargs.get('event_id') and not self.object.appliesToEvent(event):
raise Http404(_('Invalid event.'))
... | [
"def",
"get_context_data",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"event",
"=",
"Event",
".",
"objects",
".",
"filter",
"(",
"id",
"=",
"self",
".",
"kwargs",
".",
"get",
"(",
"'event_id'",
")",
")",
".",
"first",
"(",
")",
"if",
"self",
... | Add the list of names for the given guest list | [
"Add",
"the",
"list",
"of",
"names",
"for",
"the",
"given",
"guest",
"list"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/views.py#L23-L39 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | PrivateLessonEvent.getBasePrice | def getBasePrice(self,**kwargs):
'''
This method overrides the method of the base Event class by
checking the pricingTier associated with this PrivateLessonEvent and getting
the appropriate price for it.
'''
if not self.pricingTier:
return None
return ... | python | def getBasePrice(self,**kwargs):
'''
This method overrides the method of the base Event class by
checking the pricingTier associated with this PrivateLessonEvent and getting
the appropriate price for it.
'''
if not self.pricingTier:
return None
return ... | [
"def",
"getBasePrice",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"pricingTier",
":",
"return",
"None",
"return",
"self",
".",
"pricingTier",
".",
"getBasePrice",
"(",
"*",
"*",
"kwargs",
")",
"*",
"max",
"(",
"self",
"... | This method overrides the method of the base Event class by
checking the pricingTier associated with this PrivateLessonEvent and getting
the appropriate price for it. | [
"This",
"method",
"overrides",
"the",
"method",
"of",
"the",
"base",
"Event",
"class",
"by",
"checking",
"the",
"pricingTier",
"associated",
"with",
"this",
"PrivateLessonEvent",
"and",
"getting",
"the",
"appropriate",
"price",
"for",
"it",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L48-L56 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | PrivateLessonEvent.customers | def customers(self):
'''
List both any individuals signed up via the registration and payment system,
and any individuals signed up without payment.
'''
return Customer.objects.filter(
Q(privatelessoncustomer__lesson=self) |
Q(registration__eventregistrati... | python | def customers(self):
'''
List both any individuals signed up via the registration and payment system,
and any individuals signed up without payment.
'''
return Customer.objects.filter(
Q(privatelessoncustomer__lesson=self) |
Q(registration__eventregistrati... | [
"def",
"customers",
"(",
"self",
")",
":",
"return",
"Customer",
".",
"objects",
".",
"filter",
"(",
"Q",
"(",
"privatelessoncustomer__lesson",
"=",
"self",
")",
"|",
"Q",
"(",
"registration__eventregistration__event",
"=",
"self",
")",
")",
".",
"distinct",
... | List both any individuals signed up via the registration and payment system,
and any individuals signed up without payment. | [
"List",
"both",
"any",
"individuals",
"signed",
"up",
"via",
"the",
"registration",
"and",
"payment",
"system",
"and",
"any",
"individuals",
"signed",
"up",
"without",
"payment",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L122-L130 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | PrivateLessonEvent.save | def save(self, *args, **kwargs):
''' Set registration status to hidden if it is not specified otherwise '''
if not self.status:
self.status == Event.RegStatus.hidden
super(PrivateLessonEvent,self).save(*args,**kwargs) | python | def save(self, *args, **kwargs):
''' Set registration status to hidden if it is not specified otherwise '''
if not self.status:
self.status == Event.RegStatus.hidden
super(PrivateLessonEvent,self).save(*args,**kwargs) | [
"def",
"save",
"(",
"self",
",",
"*",
"args",
",",
"*",
"*",
"kwargs",
")",
":",
"if",
"not",
"self",
".",
"status",
":",
"self",
".",
"status",
"==",
"Event",
".",
"RegStatus",
".",
"hidden",
"super",
"(",
"PrivateLessonEvent",
",",
"self",
")",
"... | Set registration status to hidden if it is not specified otherwise | [
"Set",
"registration",
"status",
"to",
"hidden",
"if",
"it",
"is",
"not",
"specified",
"otherwise"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L172-L176 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | InstructorAvailabilitySlot.availableDurations | def availableDurations(self):
'''
A lesson can always be booked for the length of a single slot, but this method
checks if multiple slots are available. This method requires that slots are
non-overlapping, which needs to be enforced on slot save.
'''
potential_slots = In... | python | def availableDurations(self):
'''
A lesson can always be booked for the length of a single slot, but this method
checks if multiple slots are available. This method requires that slots are
non-overlapping, which needs to be enforced on slot save.
'''
potential_slots = In... | [
"def",
"availableDurations",
"(",
"self",
")",
":",
"potential_slots",
"=",
"InstructorAvailabilitySlot",
".",
"objects",
".",
"filter",
"(",
"instructor",
"=",
"self",
".",
"instructor",
",",
"location",
"=",
"self",
".",
"location",
",",
"room",
"=",
"self",... | A lesson can always be booked for the length of a single slot, but this method
checks if multiple slots are available. This method requires that slots are
non-overlapping, which needs to be enforced on slot save. | [
"A",
"lesson",
"can",
"always",
"be",
"booked",
"for",
"the",
"length",
"of",
"a",
"single",
"slot",
"but",
"this",
"method",
"checks",
"if",
"multiple",
"slots",
"are",
"available",
".",
"This",
"method",
"requires",
"that",
"slots",
"are",
"non",
"-",
... | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L252-L284 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | InstructorAvailabilitySlot.availableRoles | def availableRoles(self):
'''
Some instructors only offer private lessons for certain roles, so we should only allow booking
for the roles that have been selected for the instructor.
'''
if not hasattr(self.instructor,'instructorprivatelessondetails'):
return []
... | python | def availableRoles(self):
'''
Some instructors only offer private lessons for certain roles, so we should only allow booking
for the roles that have been selected for the instructor.
'''
if not hasattr(self.instructor,'instructorprivatelessondetails'):
return []
... | [
"def",
"availableRoles",
"(",
"self",
")",
":",
"if",
"not",
"hasattr",
"(",
"self",
".",
"instructor",
",",
"'instructorprivatelessondetails'",
")",
":",
"return",
"[",
"]",
"return",
"[",
"[",
"x",
".",
"id",
",",
"x",
".",
"name",
"]",
"for",
"x",
... | Some instructors only offer private lessons for certain roles, so we should only allow booking
for the roles that have been selected for the instructor. | [
"Some",
"instructors",
"only",
"offer",
"private",
"lessons",
"for",
"certain",
"roles",
"so",
"we",
"should",
"only",
"allow",
"booking",
"for",
"the",
"roles",
"that",
"have",
"been",
"selected",
"for",
"the",
"instructor",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L287-L297 |
django-danceschool/django-danceschool | danceschool/private_lessons/models.py | InstructorAvailabilitySlot.checkIfAvailable | def checkIfAvailable(self, dateTime=timezone.now()):
'''
Available slots are available, but also tentative slots that have been held as tentative
past their expiration date
'''
return (
self.startTime >= dateTime + timedelta(days=getConstant('privateLessons__closeBook... | python | def checkIfAvailable(self, dateTime=timezone.now()):
'''
Available slots are available, but also tentative slots that have been held as tentative
past their expiration date
'''
return (
self.startTime >= dateTime + timedelta(days=getConstant('privateLessons__closeBook... | [
"def",
"checkIfAvailable",
"(",
"self",
",",
"dateTime",
"=",
"timezone",
".",
"now",
"(",
")",
")",
":",
"return",
"(",
"self",
".",
"startTime",
">=",
"dateTime",
"+",
"timedelta",
"(",
"days",
"=",
"getConstant",
"(",
"'privateLessons__closeBookingDays'",
... | Available slots are available, but also tentative slots that have been held as tentative
past their expiration date | [
"Available",
"slots",
"are",
"available",
"but",
"also",
"tentative",
"slots",
"that",
"have",
"been",
"held",
"as",
"tentative",
"past",
"their",
"expiration",
"date"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L299-L313 |
django-danceschool/django-danceschool | danceschool/stats/cms_plugins.py | StatsGraphPlugin.render | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(StatsGraphPlugin,self).render(context,instance,placeholder)
# Javascript makes it difficult to calculate date/time differences, so instead
... | python | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(StatsGraphPlugin,self).render(context,instance,placeholder)
# Javascript makes it difficult to calculate date/time differences, so instead
... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"StatsGraphPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"# Javascript makes it d... | Allows this plugin to use templates designed for a list of locations. | [
"Allows",
"this",
"plugin",
"to",
"use",
"templates",
"designed",
"for",
"a",
"list",
"of",
"locations",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/cms_plugins.py#L23-L50 |
django-danceschool/django-danceschool | danceschool/private_events/feeds.py | json_event_feed | def json_event_feed(request,location_id=None,room_id=None):
'''
The Jquery fullcalendar app requires a JSON news feed, so this function
creates the feed from upcoming PrivateEvent objects
'''
if not getConstant('calendar__privateCalendarFeedEnabled') or not request.user.is_staff:
ret... | python | def json_event_feed(request,location_id=None,room_id=None):
'''
The Jquery fullcalendar app requires a JSON news feed, so this function
creates the feed from upcoming PrivateEvent objects
'''
if not getConstant('calendar__privateCalendarFeedEnabled') or not request.user.is_staff:
ret... | [
"def",
"json_event_feed",
"(",
"request",
",",
"location_id",
"=",
"None",
",",
"room_id",
"=",
"None",
")",
":",
"if",
"not",
"getConstant",
"(",
"'calendar__privateCalendarFeedEnabled'",
")",
"or",
"not",
"request",
".",
"user",
".",
"is_staff",
":",
"return... | The Jquery fullcalendar app requires a JSON news feed, so this function
creates the feed from upcoming PrivateEvent objects | [
"The",
"Jquery",
"fullcalendar",
"app",
"requires",
"a",
"JSON",
"news",
"feed",
"so",
"this",
"function",
"creates",
"the",
"feed",
"from",
"upcoming",
"PrivateEvent",
"objects"
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_events/feeds.py#L122-L159 |
django-danceschool/django-danceschool | danceschool/core/cms_plugins.py | LocationListPlugin.render | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(LocationListPlugin,self).render(context,instance,placeholder)
context['location_list'] = Location.objects.filter(status=Location.StatusChoices.active... | python | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(LocationListPlugin,self).render(context,instance,placeholder)
context['location_list'] = Location.objects.filter(status=Location.StatusChoices.active... | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"LocationListPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"context",
"[",
"'... | Allows this plugin to use templates designed for a list of locations. | [
"Allows",
"this",
"plugin",
"to",
"use",
"templates",
"designed",
"for",
"a",
"list",
"of",
"locations",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/cms_plugins.py#L71-L75 |
django-danceschool/django-danceschool | danceschool/core/cms_plugins.py | LocationPlugin.render | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(LocationPlugin,self).render(context,instance,placeholder)
context['location_list'] = [instance.location,]
return context | python | def render(self, context, instance, placeholder):
''' Allows this plugin to use templates designed for a list of locations. '''
context = super(LocationPlugin,self).render(context,instance,placeholder)
context['location_list'] = [instance.location,]
return context | [
"def",
"render",
"(",
"self",
",",
"context",
",",
"instance",
",",
"placeholder",
")",
":",
"context",
"=",
"super",
"(",
"LocationPlugin",
",",
"self",
")",
".",
"render",
"(",
"context",
",",
"instance",
",",
"placeholder",
")",
"context",
"[",
"'loca... | Allows this plugin to use templates designed for a list of locations. | [
"Allows",
"this",
"plugin",
"to",
"use",
"templates",
"designed",
"for",
"a",
"list",
"of",
"locations",
"."
] | train | https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/cms_plugins.py#L85-L89 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.