repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
partition
stringclasses
1 value
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L106-L136
train
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", "=", "paymentSessi...
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/views.py#L31-L50
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/views.py#L52-L131
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/tasks.py#L19-L34
train
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/tasks.py#L38-L52
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/tasks.py#L15-L30
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/helpers.py#L15-L36
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L303-L320
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L428-L473
train
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", ".", "querys...
pass the list of staff members along to the form
[ "pass", "the", "list", "of", "staff", "members", "along", "to", "the", "form" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L631-L635
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_events/forms.py#L181-L208
train
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/requests.py#L7-L16
train
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", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/requests.py#L19-L30
train
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__privatelessonevent...
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/handlers.py#L6-L19
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/admin.py#L382-L389
train
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", "(", "hasattr", "(", "self", ",", "'declared_fieldset'", ")", "and", "self", ".", "declared_fieldsets", ")", "or", "not", "self", ".", "base_fieldsets", ":", "r...
Override polymorphic default to put the subclass-specific fields first
[ "Override", "polymorphic", "default", "to", "put", "the", "subclass", "-", "specific", "fields", "first" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/admin.py#L427-L441
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/management/commands/setupschool.py#L36-L58
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/management/commands/setupschool.py#L60-L81
train
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", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/utils/timezone.py#L5-L17
train
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/migrations/0012_auto_20181216_1615.py#L71-L119
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/discounts/migrations/0005_auto_20170830_1159.py#L10-L16
train
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", "]", ")", "regonline", ...
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L65-L80
train
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'", "contex...
Add the event and series listing data
[ "Add", "the", "event", "and", "series", "listing", "data" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L82-L92
train
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", ".", "request", "."...
Tell the form which fields to render
[ "Tell", "the", "form", "which", "fields", "to", "render" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L94-L105
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L228-L254
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L256-L295
train
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", ":", "re...
Always check that the temporary registration has not expired
[ "Always", "check", "that", "the", "temporary", "registration", "has", "not", "expired" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L321-L347
train
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", ".", "session...
Pass the initial kwargs, then update with the needed registration info.
[ "Pass", "the", "initial", "kwargs", "then", "update", "with", "the", "needed", "registration", "info", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L440-L492
train
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'", ")", ")", "tr...
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", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L557-L581
train
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", "expiry", "=", "timezone", ".", "now", "(", ")", "+", "timedelta", "(", "minutes", "=", "getConstant", "(", "'registration__sessionExpiryMinutes'", ")", ...
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", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L666-L699
train
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", "not", ...
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"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/handlers.py#L17-L51
train
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/handlers.py#L55-L99
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/autocomplete_light_registry.py#L125-L132
train
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.'", ")", "formData", ...
Check that this individual is not on the ban list.
[ "Check", "that", "this", "individual", "is", "not", "on", "the", "ban", "list", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/banlist/handlers.py#L35-L105
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L83-L94
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L96-L124
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L416-L418
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L469-L471
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L585-L592
train
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", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'__paid'", ")", "or", "not", "hasattr", "(", "self", ",", "'__approved'", ")", ":", "if", "self", ".", "approved", "and", "not",...
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"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L724-L796
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L874-L880
train
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", ")", ":", "if", "not", "hasattr", "(", "self", ",", "'__received'", ")", ":", "if", "self", ".", "received", "and", "not", "self", ".", "receivedDate", ":", "self", ".", "receivedDate...
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"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L891-L949
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/forms.py#L70-L94
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L11-L23
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L80-L135
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/autocomplete_light_registry.py#L137-L166
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L53-L61
train
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...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L74-L92
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L96-L102
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L106-L115
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L119-L126
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L130-L137
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/templatetags/danceschool_tags.py#L141-L154
train
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", ":", "random_string", "=", "''", ".", "join", "(", "random", ".", ...
Creates a new Voucher with a unique voucherId
[ "Creates", "a", "new", "Voucher", "with", "a", "unique", "voucherId" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/models.py#L66-L79
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/prerequisites/models.py#L49-L129
train
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", ".", "de...
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"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/handlers.py#L151-L165
train
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", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/payments/square/tasks.py#L5-L17
train
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", "not", "year", ":", "year", "=", "timezone", ".", "now", "(", ")", ".", "year", "role_list", "=", "DanceRole", ".", ...
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/stats.py#L138-L211
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L61-L88
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L101-L120
train
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", ".", "request", "."...
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L137-L143
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/views.py#L308-L327
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/views.py#L18-L21
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/views.py#L23-L39
train
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", ".", "numSl...
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L48-L56
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L122-L130
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L172-L176
train
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", "-", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L252-L284
train
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", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L287-L297
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/models.py#L299-L313
train
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" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_events/feeds.py#L122-L159
train
django-danceschool/django-danceschool
danceschool/prerequisites/handlers.py
checkRequirements
def checkRequirements(sender,**kwargs): ''' Check that the customer meets all prerequisites for the items in the registration. ''' if not getConstant('requirements__enableRequirements'): return logger.debug('Signal to check RegistrationContactForm handled by prerequisites app.') ...
python
def checkRequirements(sender,**kwargs): ''' Check that the customer meets all prerequisites for the items in the registration. ''' if not getConstant('requirements__enableRequirements'): return logger.debug('Signal to check RegistrationContactForm handled by prerequisites app.') ...
[ "def", "checkRequirements", "(", "sender", ",", "**", "kwargs", ")", ":", "if", "not", "getConstant", "(", "'requirements__enableRequirements'", ")", ":", "return", "logger", ".", "debug", "(", "'Signal to check RegistrationContactForm handled by prerequisites app.'", ")"...
Check that the customer meets all prerequisites for the items in the registration.
[ "Check", "that", "the", "customer", "meets", "all", "prerequisites", "for", "the", "items", "in", "the", "registration", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/prerequisites/handlers.py#L22-L74
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
EmailRecipientMixin.get_email_context
def get_email_context(self,**kwargs): ''' This method can be overridden in classes that inherit from this mixin so that additional object-specific context is provided to the email template. This should return a dictionary. By default, only general financial context variabl...
python
def get_email_context(self,**kwargs): ''' This method can be overridden in classes that inherit from this mixin so that additional object-specific context is provided to the email template. This should return a dictionary. By default, only general financial context variabl...
[ "def", "get_email_context", "(", "self", ",", "**", "kwargs", ")", ":", "context", "=", "kwargs", "context", ".", "update", "(", "{", "'currencyCode'", ":", "getConstant", "(", "'general__currencyCode'", ")", ",", "'currencySymbol'", ":", "getConstant", "(", "...
This method can be overridden in classes that inherit from this mixin so that additional object-specific context is provided to the email template. This should return a dictionary. By default, only general financial context variables are added to the dictionary, and kwargs are just...
[ "This", "method", "can", "be", "overridden", "in", "classes", "that", "inherit", "from", "this", "mixin", "so", "that", "additional", "object", "-", "specific", "context", "is", "provided", "to", "the", "email", "template", ".", "This", "should", "return", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L107-L128
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
GroupRequiredByFieldMixin.get_group_required
def get_group_required(self): ''' Get the group_required value from the object ''' this_object = self.model_object if hasattr(this_object,self.group_required_field): if hasattr(getattr(this_object,self.group_required_field),'name'): return [getattr(this_object,se...
python
def get_group_required(self): ''' Get the group_required value from the object ''' this_object = self.model_object if hasattr(this_object,self.group_required_field): if hasattr(getattr(this_object,self.group_required_field),'name'): return [getattr(this_object,se...
[ "def", "get_group_required", "(", "self", ")", ":", "this_object", "=", "self", ".", "model_object", "if", "hasattr", "(", "this_object", ",", "self", ".", "group_required_field", ")", ":", "if", "hasattr", "(", "getattr", "(", "this_object", ",", "self", "....
Get the group_required value from the object
[ "Get", "the", "group_required", "value", "from", "the", "object" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L179-L185
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
GroupRequiredByFieldMixin.check_membership
def check_membership(self, groups): ''' Allows for objects with no required groups ''' if not groups or groups == ['']: return True if self.request.user.is_superuser: return True user_groups = self.request.user.groups.values_list("name", flat=True) ...
python
def check_membership(self, groups): ''' Allows for objects with no required groups ''' if not groups or groups == ['']: return True if self.request.user.is_superuser: return True user_groups = self.request.user.groups.values_list("name", flat=True) ...
[ "def", "check_membership", "(", "self", ",", "groups", ")", ":", "if", "not", "groups", "or", "groups", "==", "[", "''", "]", ":", "return", "True", "if", "self", ".", "request", ".", "user", ".", "is_superuser", ":", "return", "True", "user_groups", "...
Allows for objects with no required groups
[ "Allows", "for", "objects", "with", "no", "required", "groups" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L187-L194
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
GroupRequiredByFieldMixin.dispatch
def dispatch(self, request, *args, **kwargs): ''' This override of dispatch ensures that if no group is required, then the request still goes through without being logged in. ''' self.request = request in_group = False required_group = self.get_group_requir...
python
def dispatch(self, request, *args, **kwargs): ''' This override of dispatch ensures that if no group is required, then the request still goes through without being logged in. ''' self.request = request in_group = False required_group = self.get_group_requir...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "**", "kwargs", ")", ":", "self", ".", "request", "=", "request", "in_group", "=", "False", "required_group", "=", "self", ".", "get_group_required", "(", ")", "if", "not", "required_...
This override of dispatch ensures that if no group is required, then the request still goes through without being logged in.
[ "This", "override", "of", "dispatch", "ensures", "that", "if", "no", "group", "is", "required", "then", "the", "request", "still", "goes", "through", "without", "being", "logged", "in", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L196-L218
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
TemplateChoiceField.validate
def validate(self,value): ''' Check for empty values, and for an existing template, but do not check if this is one of the initial choices provided. ''' super(ChoiceField,self).validate(value) try: get_template(value) except TemplateDoesNotEx...
python
def validate(self,value): ''' Check for empty values, and for an existing template, but do not check if this is one of the initial choices provided. ''' super(ChoiceField,self).validate(value) try: get_template(value) except TemplateDoesNotEx...
[ "def", "validate", "(", "self", ",", "value", ")", ":", "super", "(", "ChoiceField", ",", "self", ")", ".", "validate", "(", "value", ")", "try", ":", "get_template", "(", "value", ")", "except", "TemplateDoesNotExist", ":", "raise", "ValidationError", "("...
Check for empty values, and for an existing template, but do not check if this is one of the initial choices provided.
[ "Check", "for", "empty", "values", "and", "for", "an", "existing", "template", "but", "do", "not", "check", "if", "this", "is", "one", "of", "the", "initial", "choices", "provided", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L242-L252
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
PluginTemplateMixin.render
def render(self, context, instance, placeholder): ''' Permits setting of the template in the plugin instance configuration ''' if instance and instance.template: self.render_template = instance.template return super(PluginTemplateMixin,self).render(context,instance,placeholder)
python
def render(self, context, instance, placeholder): ''' Permits setting of the template in the plugin instance configuration ''' if instance and instance.template: self.render_template = instance.template return super(PluginTemplateMixin,self).render(context,instance,placeholder)
[ "def", "render", "(", "self", ",", "context", ",", "instance", ",", "placeholder", ")", ":", "if", "instance", "and", "instance", ".", "template", ":", "self", ".", "render_template", "=", "instance", ".", "template", "return", "super", "(", "PluginTemplateM...
Permits setting of the template in the plugin instance configuration
[ "Permits", "setting", "of", "the", "template", "in", "the", "plugin", "instance", "configuration" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L261-L265
train
django-danceschool/django-danceschool
danceschool/core/mixins.py
SiteHistoryMixin.get_return_page
def get_return_page(self,prior=False): ''' This is just a wrapper for the getReturnPage helper function. ''' siteHistory = self.request.session.get('SITE_HISTORY',{}) return getReturnPage(siteHistory,prior=prior)
python
def get_return_page(self,prior=False): ''' This is just a wrapper for the getReturnPage helper function. ''' siteHistory = self.request.session.get('SITE_HISTORY',{}) return getReturnPage(siteHistory,prior=prior)
[ "def", "get_return_page", "(", "self", ",", "prior", "=", "False", ")", ":", "siteHistory", "=", "self", ".", "request", ".", "session", ".", "get", "(", "'SITE_HISTORY'", ",", "{", "}", ")", "return", "getReturnPage", "(", "siteHistory", ",", "prior", "...
This is just a wrapper for the getReturnPage helper function.
[ "This", "is", "just", "a", "wrapper", "for", "the", "getReturnPage", "helper", "function", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/mixins.py#L487-L490
train
django-danceschool/django-danceschool
danceschool/core/forms.py
RegistrationContactForm.is_valid
def is_valid(self): ''' For this form to be considered valid, there must be not only no errors, but also no messages on the request that need to be shown. ''' valid = super(RegistrationContactForm,self).is_valid() msgs = messages.get_messages(self._request) # We...
python
def is_valid(self): ''' For this form to be considered valid, there must be not only no errors, but also no messages on the request that need to be shown. ''' valid = super(RegistrationContactForm,self).is_valid() msgs = messages.get_messages(self._request) # We...
[ "def", "is_valid", "(", "self", ")", ":", "valid", "=", "super", "(", "RegistrationContactForm", ",", "self", ")", ".", "is_valid", "(", ")", "msgs", "=", "messages", ".", "get_messages", "(", "self", ".", "_request", ")", "prior_messages", "=", "self", ...
For this form to be considered valid, there must be not only no errors, but also no messages on the request that need to be shown.
[ "For", "this", "form", "to", "be", "considered", "valid", "there", "must", "be", "not", "only", "no", "errors", "but", "also", "no", "messages", "on", "the", "request", "that", "need", "to", "be", "shown", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/forms.py#L378-L401
train
django-danceschool/django-danceschool
danceschool/core/forms.py
RefundForm.clean_total_refund_amount
def clean_total_refund_amount(self): ''' The Javascript should ensure that the hidden input is updated, but double check it here. ''' initial = self.cleaned_data.get('initial_refund_amount', 0) total = self.cleaned_data['total_refund_amount'] summed_refunds = sum([v for k...
python
def clean_total_refund_amount(self): ''' The Javascript should ensure that the hidden input is updated, but double check it here. ''' initial = self.cleaned_data.get('initial_refund_amount', 0) total = self.cleaned_data['total_refund_amount'] summed_refunds = sum([v for k...
[ "def", "clean_total_refund_amount", "(", "self", ")", ":", "initial", "=", "self", ".", "cleaned_data", ".", "get", "(", "'initial_refund_amount'", ",", "0", ")", "total", "=", "self", ".", "cleaned_data", "[", "'total_refund_amount'", "]", "summed_refunds", "="...
The Javascript should ensure that the hidden input is updated, but double check it here.
[ "The", "Javascript", "should", "ensure", "that", "the", "hidden", "input", "is", "updated", "but", "double", "check", "it", "here", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/forms.py#L662-L679
train
django-danceschool/django-danceschool
danceschool/core/forms.py
SubstituteReportingForm.clean
def clean(self): ''' This code prevents multiple individuals from substituting for the same class and class teacher. It also prevents an individual from substituting for a class in which they are a teacher. ''' super(SubstituteReportingForm,self).clean() occurre...
python
def clean(self): ''' This code prevents multiple individuals from substituting for the same class and class teacher. It also prevents an individual from substituting for a class in which they are a teacher. ''' super(SubstituteReportingForm,self).clean() occurre...
[ "def", "clean", "(", "self", ")", ":", "super", "(", "SubstituteReportingForm", ",", "self", ")", ".", "clean", "(", ")", "occurrences", "=", "self", ".", "cleaned_data", ".", "get", "(", "'occurrences'", ",", "[", "]", ")", "staffMember", "=", "self", ...
This code prevents multiple individuals from substituting for the same class and class teacher. It also prevents an individual from substituting for a class in which they are a teacher.
[ "This", "code", "prevents", "multiple", "individuals", "from", "substituting", "for", "the", "same", "class", "and", "class", "teacher", ".", "It", "also", "prevents", "an", "individual", "from", "substituting", "for", "a", "class", "in", "which", "they", "are...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/forms.py#L868-L888
train
django-danceschool/django-danceschool
danceschool/core/forms.py
SubstituteReportingForm.save
def save(self, commit=True): ''' If a staff member is reporting substitute teaching for a second time, then we should update the list of occurrences for which they are a substitute on their existing EventStaffMember record, rather than creating a new record and creating database issues. ...
python
def save(self, commit=True): ''' If a staff member is reporting substitute teaching for a second time, then we should update the list of occurrences for which they are a substitute on their existing EventStaffMember record, rather than creating a new record and creating database issues. ...
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "existing_record", "=", "EventStaffMember", ".", "objects", ".", "filter", "(", "staffMember", "=", "self", ".", "cleaned_data", ".", "get", "(", "'staffMember'", ")", ",", "event", "=", "...
If a staff member is reporting substitute teaching for a second time, then we should update the list of occurrences for which they are a substitute on their existing EventStaffMember record, rather than creating a new record and creating database issues.
[ "If", "a", "staff", "member", "is", "reporting", "substitute", "teaching", "for", "a", "second", "time", "then", "we", "should", "update", "the", "list", "of", "occurrences", "for", "which", "they", "are", "a", "substitute", "on", "their", "existing", "Event...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/forms.py#L898-L917
train
django-danceschool/django-danceschool
danceschool/core/forms.py
StaffMemberBioChangeForm.save
def save(self, commit=True): ''' If the staff member is an instructor, also update the availableForPrivates field on the Instructor record. ''' if getattr(self.instance,'instructor',None): self.instance.instructor.availableForPrivates = self.cleaned_data.pop('availableForPrivates',self.insta...
python
def save(self, commit=True): ''' If the staff member is an instructor, also update the availableForPrivates field on the Instructor record. ''' if getattr(self.instance,'instructor',None): self.instance.instructor.availableForPrivates = self.cleaned_data.pop('availableForPrivates',self.insta...
[ "def", "save", "(", "self", ",", "commit", "=", "True", ")", ":", "if", "getattr", "(", "self", ".", "instance", ",", "'instructor'", ",", "None", ")", ":", "self", ".", "instance", ".", "instructor", ".", "availableForPrivates", "=", "self", ".", "cle...
If the staff member is an instructor, also update the availableForPrivates field on the Instructor record.
[ "If", "the", "staff", "member", "is", "an", "instructor", "also", "update", "the", "availableForPrivates", "field", "on", "the", "Instructor", "record", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/forms.py#L942-L947
train
django-danceschool/django-danceschool
danceschool/core/models.py
DanceRole.save
def save(self, *args, **kwargs): ''' Just add "s" if no plural name given. ''' if not self.pluralName: self.pluralName = self.name + 's' super(self.__class__, self).save(*args, **kwargs)
python
def save(self, *args, **kwargs): ''' Just add "s" if no plural name given. ''' if not self.pluralName: self.pluralName = self.name + 's' super(self.__class__, self).save(*args, **kwargs)
[ "def", "save", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "not", "self", ".", "pluralName", ":", "self", ".", "pluralName", "=", "self", ".", "name", "+", "'s'", "super", "(", "self", ".", "__class__", ",", "self", ")", "...
Just add "s" if no plural name given.
[ "Just", "add", "s", "if", "no", "plural", "name", "given", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L83-L89
train
django-danceschool/django-danceschool
danceschool/core/models.py
PricingTier.getBasePrice
def getBasePrice(self,**kwargs): ''' This handles the logic of finding the correct price. If more sophisticated discounting systems are needed, then this PricingTier model can be subclassed, or the discounts and vouchers apps can be used. ''' payAtDoor = kwargs.get('payA...
python
def getBasePrice(self,**kwargs): ''' This handles the logic of finding the correct price. If more sophisticated discounting systems are needed, then this PricingTier model can be subclassed, or the discounts and vouchers apps can be used. ''' payAtDoor = kwargs.get('payA...
[ "def", "getBasePrice", "(", "self", ",", "**", "kwargs", ")", ":", "payAtDoor", "=", "kwargs", ".", "get", "(", "'payAtDoor'", ",", "False", ")", "dropIns", "=", "kwargs", ".", "get", "(", "'dropIns'", ",", "0", ")", "if", "dropIns", ":", "return", "...
This handles the logic of finding the correct price. If more sophisticated discounting systems are needed, then this PricingTier model can be subclassed, or the discounts and vouchers apps can be used.
[ "This", "handles", "the", "logic", "of", "finding", "the", "correct", "price", ".", "If", "more", "sophisticated", "discounting", "systems", "are", "needed", "then", "this", "PricingTier", "model", "can", "be", "subclassed", "or", "the", "discounts", "and", "v...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L432-L445
train
django-danceschool/django-danceschool
danceschool/core/models.py
Event.availableRoles
def availableRoles(self): ''' Returns the set of roles for this event. Since roles are not always custom specified for event, this looks for the set of available roles in multiple places. If no roles are found, then the method returns an empty list, in which case it can be assumed that...
python
def availableRoles(self): ''' Returns the set of roles for this event. Since roles are not always custom specified for event, this looks for the set of available roles in multiple places. If no roles are found, then the method returns an empty list, in which case it can be assumed that...
[ "def", "availableRoles", "(", "self", ")", ":", "eventRoles", "=", "self", ".", "eventrole_set", ".", "filter", "(", "capacity__gt", "=", "0", ")", "if", "eventRoles", ".", "count", "(", ")", ">", "0", ":", "return", "[", "x", ".", "role", "for", "x"...
Returns the set of roles for this event. Since roles are not always custom specified for event, this looks for the set of available roles in multiple places. If no roles are found, then the method returns an empty list, in which case it can be assumed that the event's registration is not role-...
[ "Returns", "the", "set", "of", "roles", "for", "this", "event", ".", "Since", "roles", "are", "not", "always", "custom", "specified", "for", "event", "this", "looks", "for", "the", "set", "of", "available", "roles", "in", "multiple", "places", ".", "If", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L952-L964
train
django-danceschool/django-danceschool
danceschool/core/models.py
Event.numRegisteredForRole
def numRegisteredForRole(self, role, includeTemporaryRegs=False): ''' Accepts a DanceRole object and returns the number of registrations of that role. ''' count = self.eventregistration_set.filter(cancelled=False,dropIn=False,role=role).count() if includeTemporaryRegs: ...
python
def numRegisteredForRole(self, role, includeTemporaryRegs=False): ''' Accepts a DanceRole object and returns the number of registrations of that role. ''' count = self.eventregistration_set.filter(cancelled=False,dropIn=False,role=role).count() if includeTemporaryRegs: ...
[ "def", "numRegisteredForRole", "(", "self", ",", "role", ",", "includeTemporaryRegs", "=", "False", ")", ":", "count", "=", "self", ".", "eventregistration_set", ".", "filter", "(", "cancelled", "=", "False", ",", "dropIn", "=", "False", ",", "role", "=", ...
Accepts a DanceRole object and returns the number of registrations of that role.
[ "Accepts", "a", "DanceRole", "object", "and", "returns", "the", "number", "of", "registrations", "of", "that", "role", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L967-L975
train
django-danceschool/django-danceschool
danceschool/core/models.py
Event.capacityForRole
def capacityForRole(self,role): ''' Accepts a DanceRole object and determines the capacity for that role at this event.this Since roles are not always custom specified for events, this looks for the set of available roles in multiple places, and only returns the overall capacity of the e...
python
def capacityForRole(self,role): ''' Accepts a DanceRole object and determines the capacity for that role at this event.this Since roles are not always custom specified for events, this looks for the set of available roles in multiple places, and only returns the overall capacity of the e...
[ "def", "capacityForRole", "(", "self", ",", "role", ")", ":", "if", "isinstance", "(", "role", ",", "DanceRole", ")", ":", "role_id", "=", "role", ".", "id", "else", ":", "role_id", "=", "role", "eventRoles", "=", "self", ".", "eventrole_set", ".", "fi...
Accepts a DanceRole object and determines the capacity for that role at this event.this Since roles are not always custom specified for events, this looks for the set of available roles in multiple places, and only returns the overall capacity of the event if roles are not found elsewhere.
[ "Accepts", "a", "DanceRole", "object", "and", "determines", "the", "capacity", "for", "that", "role", "at", "this", "event", ".", "this", "Since", "roles", "are", "not", "always", "custom", "specified", "for", "events", "this", "looks", "for", "the", "set", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L986-L1022
train
django-danceschool/django-danceschool
danceschool/core/models.py
Event.soldOutForRole
def soldOutForRole(self,role,includeTemporaryRegs=False): ''' Accepts a DanceRole object and responds if the number of registrations for that role exceeds the capacity for that role at this event. ''' return self.numRegisteredForRole( role,includeTemporaryRegs=include...
python
def soldOutForRole(self,role,includeTemporaryRegs=False): ''' Accepts a DanceRole object and responds if the number of registrations for that role exceeds the capacity for that role at this event. ''' return self.numRegisteredForRole( role,includeTemporaryRegs=include...
[ "def", "soldOutForRole", "(", "self", ",", "role", ",", "includeTemporaryRegs", "=", "False", ")", ":", "return", "self", ".", "numRegisteredForRole", "(", "role", ",", "includeTemporaryRegs", "=", "includeTemporaryRegs", ")", ">=", "(", "self", ".", "capacityFo...
Accepts a DanceRole object and responds if the number of registrations for that role exceeds the capacity for that role at this event.
[ "Accepts", "a", "DanceRole", "object", "and", "responds", "if", "the", "number", "of", "registrations", "for", "that", "role", "exceeds", "the", "capacity", "for", "that", "role", "at", "this", "event", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1024-L1030
train
django-danceschool/django-danceschool
danceschool/core/models.py
EventOccurrence.allDayForDate
def allDayForDate(self,this_date,timeZone=None): ''' This method determines whether the occurrence lasts the entirety of a specified day in the specified time zone. If no time zone is specified, then it uses the default time zone). Also, give a grace period of a few minutes to ...
python
def allDayForDate(self,this_date,timeZone=None): ''' This method determines whether the occurrence lasts the entirety of a specified day in the specified time zone. If no time zone is specified, then it uses the default time zone). Also, give a grace period of a few minutes to ...
[ "def", "allDayForDate", "(", "self", ",", "this_date", ",", "timeZone", "=", "None", ")", ":", "if", "isinstance", "(", "this_date", ",", "datetime", ")", ":", "d", "=", "this_date", ".", "date", "(", ")", "else", ":", "d", "=", "this_date", "date_star...
This method determines whether the occurrence lasts the entirety of a specified day in the specified time zone. If no time zone is specified, then it uses the default time zone). Also, give a grace period of a few minutes to account for issues with the way events are sometimes entered.
[ "This", "method", "determines", "whether", "the", "occurrence", "lasts", "the", "entirety", "of", "a", "specified", "day", "in", "the", "specified", "time", "zone", ".", "If", "no", "time", "zone", "is", "specified", "then", "it", "uses", "the", "default", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1191-L1211
train
django-danceschool/django-danceschool
danceschool/core/models.py
EventStaffMember.netHours
def netHours(self): ''' For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is caclulated net of any substitutes. ''' if self.specifiedHours is not None: return self.specifiedHours elif self.category in [getC...
python
def netHours(self): ''' For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is caclulated net of any substitutes. ''' if self.specifiedHours is not None: return self.specifiedHours elif self.category in [getC...
[ "def", "netHours", "(", "self", ")", ":", "if", "self", ".", "specifiedHours", "is", "not", "None", ":", "return", "self", ".", "specifiedHours", "elif", "self", ".", "category", "in", "[", "getConstant", "(", "'general__eventStaffCategoryAssistant'", ")", ","...
For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is caclulated net of any substitutes.
[ "For", "regular", "event", "staff", "this", "is", "the", "net", "hours", "worked", "for", "financial", "purposes", ".", "For", "Instructors", "netHours", "is", "caclulated", "net", "of", "any", "substitutes", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1284-L1294
train
django-danceschool/django-danceschool
danceschool/core/models.py
Series.shortDescription
def shortDescription(self): ''' Overrides property from Event base class. ''' cd = getattr(self,'classDescription',None) if cd: sd = getattr(cd,'shortDescription','') d = getattr(cd,'description','') return sd if sd else d return ''
python
def shortDescription(self): ''' Overrides property from Event base class. ''' cd = getattr(self,'classDescription',None) if cd: sd = getattr(cd,'shortDescription','') d = getattr(cd,'description','') return sd if sd else d return ''
[ "def", "shortDescription", "(", "self", ")", ":", "cd", "=", "getattr", "(", "self", ",", "'classDescription'", ",", "None", ")", "if", "cd", ":", "sd", "=", "getattr", "(", "cd", ",", "'shortDescription'", ",", "''", ")", "d", "=", "getattr", "(", "...
Overrides property from Event base class.
[ "Overrides", "property", "from", "Event", "base", "class", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1360-L1369
train
django-danceschool/django-danceschool
danceschool/core/models.py
SeriesTeacher.netHours
def netHours(self): ''' For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is calculated net of any substitutes. ''' if self.specifiedHours is not None: return self.specifiedHours return self.event.duration ...
python
def netHours(self): ''' For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is calculated net of any substitutes. ''' if self.specifiedHours is not None: return self.specifiedHours return self.event.duration ...
[ "def", "netHours", "(", "self", ")", ":", "if", "self", ".", "specifiedHours", "is", "not", "None", ":", "return", "self", ".", "specifiedHours", "return", "self", ".", "event", ".", "duration", "-", "sum", "(", "[", "sub", ".", "netHours", "for", "sub...
For regular event staff, this is the net hours worked for financial purposes. For Instructors, netHours is calculated net of any substitutes.
[ "For", "regular", "event", "staff", "this", "is", "the", "net", "hours", "worked", "for", "financial", "purposes", ".", "For", "Instructors", "netHours", "is", "calculated", "net", "of", "any", "substitutes", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1466-L1473
train
django-danceschool/django-danceschool
danceschool/core/models.py
TemporaryRegistration.getTimeOfClassesRemaining
def getTimeOfClassesRemaining(self,numClasses=0): ''' For checking things like prerequisites, it's useful to check if a requirement is 'almost' met ''' occurrences = EventOccurrence.objects.filter( cancelled=False, event__in=[x.event for x in self.temporaryeventre...
python
def getTimeOfClassesRemaining(self,numClasses=0): ''' For checking things like prerequisites, it's useful to check if a requirement is 'almost' met ''' occurrences = EventOccurrence.objects.filter( cancelled=False, event__in=[x.event for x in self.temporaryeventre...
[ "def", "getTimeOfClassesRemaining", "(", "self", ",", "numClasses", "=", "0", ")", ":", "occurrences", "=", "EventOccurrence", ".", "objects", ".", "filter", "(", "cancelled", "=", "False", ",", "event__in", "=", "[", "x", ".", "event", "for", "x", "in", ...
For checking things like prerequisites, it's useful to check if a requirement is 'almost' met
[ "For", "checking", "things", "like", "prerequisites", "it", "s", "useful", "to", "check", "if", "a", "requirement", "is", "almost", "met" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1952-L1963
train
django-danceschool/django-danceschool
danceschool/core/models.py
TemporaryRegistration.finalize
def finalize(self,**kwargs): ''' This method is called when the payment process has been completed and a registration is ready to be finalized. It also fires the post-registration signal ''' dateTime = kwargs.pop('dateTime', timezone.now()) # If sendEmail is passed as F...
python
def finalize(self,**kwargs): ''' This method is called when the payment process has been completed and a registration is ready to be finalized. It also fires the post-registration signal ''' dateTime = kwargs.pop('dateTime', timezone.now()) # If sendEmail is passed as F...
[ "def", "finalize", "(", "self", ",", "**", "kwargs", ")", ":", "dateTime", "=", "kwargs", ".", "pop", "(", "'dateTime'", ",", "timezone", ".", "now", "(", ")", ")", "sendEmail", "=", "kwargs", ".", "pop", "(", "'sendEmail'", ",", "True", ")", "custom...
This method is called when the payment process has been completed and a registration is ready to be finalized. It also fires the post-registration signal
[ "This", "method", "is", "called", "when", "the", "payment", "process", "has", "been", "completed", "and", "a", "registration", "is", "ready", "to", "be", "finalized", ".", "It", "also", "fires", "the", "post", "-", "registration", "signal" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L1987-L2061
train
django-danceschool/django-danceschool
danceschool/core/models.py
EmailTemplate.save
def save(self, *args, **kwargs): ''' If this is an HTML template, then set the non-HTML content to be the stripped version of the HTML. If this is a plain text template, then set the HTML content to be null. ''' if self.send_html: self.content = get_text_for_html(self...
python
def save(self, *args, **kwargs): ''' If this is an HTML template, then set the non-HTML content to be the stripped version of the HTML. If this is a plain text template, then set the HTML content to be null. ''' if self.send_html: self.content = get_text_for_html(self...
[ "def", "save", "(", "self", ",", "*", "args", ",", "**", "kwargs", ")", ":", "if", "self", ".", "send_html", ":", "self", ".", "content", "=", "get_text_for_html", "(", "self", ".", "html_content", ")", "else", ":", "self", ".", "html_content", "=", ...
If this is an HTML template, then set the non-HTML content to be the stripped version of the HTML. If this is a plain text template, then set the HTML content to be null.
[ "If", "this", "is", "an", "HTML", "template", "then", "set", "the", "non", "-", "HTML", "content", "to", "be", "the", "stripped", "version", "of", "the", "HTML", ".", "If", "this", "is", "a", "plain", "text", "template", "then", "set", "the", "HTML", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L2469-L2479
train
django-danceschool/django-danceschool
danceschool/core/models.py
Invoice.create_from_registration
def create_from_registration(cls, reg, **kwargs): ''' Handles the creation of an Invoice as well as one InvoiceItem per assodciated TemporaryEventRegistration or registration. Also handles taxes appropriately. ''' submissionUser = kwargs.pop('submissionUser', None) ...
python
def create_from_registration(cls, reg, **kwargs): ''' Handles the creation of an Invoice as well as one InvoiceItem per assodciated TemporaryEventRegistration or registration. Also handles taxes appropriately. ''' submissionUser = kwargs.pop('submissionUser', None) ...
[ "def", "create_from_registration", "(", "cls", ",", "reg", ",", "**", "kwargs", ")", ":", "submissionUser", "=", "kwargs", ".", "pop", "(", "'submissionUser'", ",", "None", ")", "collectedByUser", "=", "kwargs", ".", "pop", "(", "'collectedByUser'", ",", "No...
Handles the creation of an Invoice as well as one InvoiceItem per assodciated TemporaryEventRegistration or registration. Also handles taxes appropriately.
[ "Handles", "the", "creation", "of", "an", "Invoice", "as", "well", "as", "one", "InvoiceItem", "per", "assodciated", "TemporaryEventRegistration", "or", "registration", ".", "Also", "handles", "taxes", "appropriately", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L2591-L2656
train
django-danceschool/django-danceschool
danceschool/core/models.py
Invoice.url
def url(self): ''' Because invoice URLs are generally emailed, this includes the default site URL and the protocol specified in settings. ''' if self.id: return '%s://%s%s' % ( getConstant('email__linkProtocol'), Site.objects.ge...
python
def url(self): ''' Because invoice URLs are generally emailed, this includes the default site URL and the protocol specified in settings. ''' if self.id: return '%s://%s%s' % ( getConstant('email__linkProtocol'), Site.objects.ge...
[ "def", "url", "(", "self", ")", ":", "if", "self", ".", "id", ":", "return", "'%s://%s%s'", "%", "(", "getConstant", "(", "'email__linkProtocol'", ")", ",", "Site", ".", "objects", ".", "get_current", "(", ")", ".", "domain", ",", "reverse", "(", "'vie...
Because invoice URLs are generally emailed, this includes the default site URL and the protocol specified in settings.
[ "Because", "invoice", "URLs", "are", "generally", "emailed", "this", "includes", "the", "default", "site", "URL", "and", "the", "protocol", "specified", "in", "settings", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L2710-L2721
train
django-danceschool/django-danceschool
danceschool/core/models.py
Invoice.calculateTaxes
def calculateTaxes(self): ''' Updates the tax field to reflect the amount of taxes depending on the local rate as well as whether the buyer or seller pays sales tax. ''' tax_rate = (getConstant('registration__salesTaxRate') or 0) / 100 if tax_rate > 0: if se...
python
def calculateTaxes(self): ''' Updates the tax field to reflect the amount of taxes depending on the local rate as well as whether the buyer or seller pays sales tax. ''' tax_rate = (getConstant('registration__salesTaxRate') or 0) / 100 if tax_rate > 0: if se...
[ "def", "calculateTaxes", "(", "self", ")", ":", "tax_rate", "=", "(", "getConstant", "(", "'registration__salesTaxRate'", ")", "or", "0", ")", "/", "100", "if", "tax_rate", ">", "0", ":", "if", "self", ".", "buyerPaysSalesTax", ":", "self", ".", "taxes", ...
Updates the tax field to reflect the amount of taxes depending on the local rate as well as whether the buyer or seller pays sales tax.
[ "Updates", "the", "tax", "field", "to", "reflect", "the", "amount", "of", "taxes", "depending", "on", "the", "local", "rate", "as", "well", "as", "whether", "the", "buyer", "or", "seller", "pays", "sales", "tax", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/models.py#L2777-L2793
train