id
int32
0
252k
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
3,500
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.create_devices
def create_devices(self, thing_names, config_file, region=None, cert_dir=None, append=False, account_id=None, policy_name='ggd-discovery-policy', profile_name=None): """ Using the `thing_names` values, creates Things in AWS IoT, attaches and download...
python
def create_devices(self, thing_names, config_file, region=None, cert_dir=None, append=False, account_id=None, policy_name='ggd-discovery-policy', profile_name=None): """ Using the `thing_names` values, creates Things in AWS IoT, attaches and download...
[ "def", "create_devices", "(", "self", ",", "thing_names", ",", "config_file", ",", "region", "=", "None", ",", "cert_dir", "=", "None", ",", "append", "=", "False", ",", "account_id", "=", "None", ",", "policy_name", "=", "'ggd-discovery-policy'", ",", "prof...
Using the `thing_names` values, creates Things in AWS IoT, attaches and downloads new keys & certs to the certificate directory, then records the created information in the local config file for inclusion in the Greengrass Group as Greengrass Devices. :param thing_names: the thing name ...
[ "Using", "the", "thing_names", "values", "creates", "Things", "in", "AWS", "IoT", "attaches", "and", "downloads", "new", "keys", "&", "certs", "to", "the", "certificate", "directory", "then", "records", "the", "created", "information", "in", "the", "local", "c...
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L773-L837
3,501
awslabs/aws-greengrass-group-setup
gg_group_setup/cmd.py
GroupCommands.associate_devices
def associate_devices(self, thing_names, config_file, region=None, profile_name=None): # TODO remove this function when Group discovery is enriched """ Using the `thing_names` values, associate existing Things in AWS IoT with the config of another Greengrass Gro...
python
def associate_devices(self, thing_names, config_file, region=None, profile_name=None): # TODO remove this function when Group discovery is enriched """ Using the `thing_names` values, associate existing Things in AWS IoT with the config of another Greengrass Gro...
[ "def", "associate_devices", "(", "self", ",", "thing_names", ",", "config_file", ",", "region", "=", "None", ",", "profile_name", "=", "None", ")", ":", "# TODO remove this function when Group discovery is enriched", "logging", ".", "info", "(", "\"associate_devices thi...
Using the `thing_names` values, associate existing Things in AWS IoT with the config of another Greengrass Group for use as Greengrass Devices. :param thing_names: the thing name or list of thing names to associate as Greengrass Devices :param config_file: config file used t...
[ "Using", "the", "thing_names", "values", "associate", "existing", "Things", "in", "AWS", "IoT", "with", "the", "config", "of", "another", "Greengrass", "Group", "for", "use", "as", "Greengrass", "Devices", "." ]
06189ceccb794fedf80e0e7649938c18792e16c9
https://github.com/awslabs/aws-greengrass-group-setup/blob/06189ceccb794fedf80e0e7649938c18792e16c9/gg_group_setup/cmd.py#L839-L878
3,502
coinkite/connectrum
connectrum/protocol.py
StratumProtocol.send_data
def send_data(self, message): ''' Given an object, encode as JSON and transmit to the server. ''' #logger.debug("TX:\n%s", json.dumps(message, indent=2)) data = json.dumps(message).encode('utf-8') + b'\n' self.transport.write(data)
python
def send_data(self, message): ''' Given an object, encode as JSON and transmit to the server. ''' #logger.debug("TX:\n%s", json.dumps(message, indent=2)) data = json.dumps(message).encode('utf-8') + b'\n' self.transport.write(data)
[ "def", "send_data", "(", "self", ",", "message", ")", ":", "#logger.debug(\"TX:\\n%s\", json.dumps(message, indent=2))", "data", "=", "json", ".", "dumps", "(", "message", ")", ".", "encode", "(", "'utf-8'", ")", "+", "b'\\n'", "self", ".", "transport", ".", "...
Given an object, encode as JSON and transmit to the server.
[ "Given", "an", "object", "encode", "as", "JSON", "and", "transmit", "to", "the", "server", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/protocol.py#L57-L63
3,503
coinkite/connectrum
connectrum/findall.py
IrcListener.got_who_reply
async def got_who_reply(self, nick=None, real_name=None, **kws): ''' Server replied to one of our WHO requests, with details. ''' #logger.debug('who reply: %r' % kws) nick = nick[2:] if nick[0:2] == 'E_' else nick host, ports = real_name.split(' ', 1) self.s...
python
async def got_who_reply(self, nick=None, real_name=None, **kws): ''' Server replied to one of our WHO requests, with details. ''' #logger.debug('who reply: %r' % kws) nick = nick[2:] if nick[0:2] == 'E_' else nick host, ports = real_name.split(' ', 1) self.s...
[ "async", "def", "got_who_reply", "(", "self", ",", "nick", "=", "None", ",", "real_name", "=", "None", ",", "*", "*", "kws", ")", ":", "#logger.debug('who reply: %r' % kws)", "nick", "=", "nick", "[", "2", ":", "]", "if", "nick", "[", "0", ":", "2", ...
Server replied to one of our WHO requests, with details.
[ "Server", "replied", "to", "one", "of", "our", "WHO", "requests", "with", "details", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/findall.py#L59-L74
3,504
coinkite/connectrum
connectrum/client.py
StratumClient._keepalive
async def _keepalive(self): ''' Keep our connect to server alive forever, with some pointless traffic. ''' while self.protocol: vers = await self.RPC('server.version') logger.debug("Server version: " + repr(vers)) # Five minutes isn't...
python
async def _keepalive(self): ''' Keep our connect to server alive forever, with some pointless traffic. ''' while self.protocol: vers = await self.RPC('server.version') logger.debug("Server version: " + repr(vers)) # Five minutes isn't...
[ "async", "def", "_keepalive", "(", "self", ")", ":", "while", "self", ".", "protocol", ":", "vers", "=", "await", "self", ".", "RPC", "(", "'server.version'", ")", "logger", ".", "debug", "(", "\"Server version: \"", "+", "repr", "(", "vers", ")", ")", ...
Keep our connect to server alive forever, with some pointless traffic.
[ "Keep", "our", "connect", "to", "server", "alive", "forever", "with", "some", "pointless", "traffic", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/client.py#L161-L173
3,505
coinkite/connectrum
connectrum/client.py
StratumClient._send_request
def _send_request(self, method, params=[], is_subscribe = False): ''' Send a new request to the server. Serialized the JSON and tracks id numbers and optional callbacks. ''' # pick a new ID self.next_id += 1 req_id = self.next_id # serialize as JS...
python
def _send_request(self, method, params=[], is_subscribe = False): ''' Send a new request to the server. Serialized the JSON and tracks id numbers and optional callbacks. ''' # pick a new ID self.next_id += 1 req_id = self.next_id # serialize as JS...
[ "def", "_send_request", "(", "self", ",", "method", ",", "params", "=", "[", "]", ",", "is_subscribe", "=", "False", ")", ":", "# pick a new ID", "self", ".", "next_id", "+=", "1", "req_id", "=", "self", ".", "next_id", "# serialize as JSON", "msg", "=", ...
Send a new request to the server. Serialized the JSON and tracks id numbers and optional callbacks.
[ "Send", "a", "new", "request", "to", "the", "server", ".", "Serialized", "the", "JSON", "and", "tracks", "id", "numbers", "and", "optional", "callbacks", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/client.py#L176-L210
3,506
coinkite/connectrum
connectrum/client.py
StratumClient._got_response
def _got_response(self, msg): ''' Decode and dispatch responses from the server. Has already been unframed and deserialized into an object. ''' #logger.debug("MSG: %r" % msg) resp_id = msg.get('id', None) if resp_id is None: # subscription ...
python
def _got_response(self, msg): ''' Decode and dispatch responses from the server. Has already been unframed and deserialized into an object. ''' #logger.debug("MSG: %r" % msg) resp_id = msg.get('id', None) if resp_id is None: # subscription ...
[ "def", "_got_response", "(", "self", ",", "msg", ")", ":", "#logger.debug(\"MSG: %r\" % msg)", "resp_id", "=", "msg", ".", "get", "(", "'id'", ",", "None", ")", "if", "resp_id", "is", "None", ":", "# subscription traffic comes with method set, but no req id.", "meth...
Decode and dispatch responses from the server. Has already been unframed and deserialized into an object.
[ "Decode", "and", "dispatch", "responses", "from", "the", "server", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/client.py#L212-L260
3,507
coinkite/connectrum
connectrum/svr_info.py
KnownServers.from_json
def from_json(self, fname): ''' Read contents of a CSV containing a list of servers. ''' with open(fname, 'rt') as fp: for row in json.load(fp): nn = ServerInfo.from_dict(row) self[str(nn)] = nn
python
def from_json(self, fname): ''' Read contents of a CSV containing a list of servers. ''' with open(fname, 'rt') as fp: for row in json.load(fp): nn = ServerInfo.from_dict(row) self[str(nn)] = nn
[ "def", "from_json", "(", "self", ",", "fname", ")", ":", "with", "open", "(", "fname", ",", "'rt'", ")", "as", "fp", ":", "for", "row", "in", "json", ".", "load", "(", "fp", ")", ":", "nn", "=", "ServerInfo", ".", "from_dict", "(", "row", ")", ...
Read contents of a CSV containing a list of servers.
[ "Read", "contents", "of", "a", "CSV", "containing", "a", "list", "of", "servers", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/svr_info.py#L171-L178
3,508
coinkite/connectrum
connectrum/svr_info.py
KnownServers.from_irc
def from_irc(self, irc_nickname=None, irc_password=None): ''' Connect to the IRC channel and find all servers presently connected. Slow; takes 30+ seconds but authoritative and current. OBSOLETE. ''' if have_bottom: from .findall import IrcListen...
python
def from_irc(self, irc_nickname=None, irc_password=None): ''' Connect to the IRC channel and find all servers presently connected. Slow; takes 30+ seconds but authoritative and current. OBSOLETE. ''' if have_bottom: from .findall import IrcListen...
[ "def", "from_irc", "(", "self", ",", "irc_nickname", "=", "None", ",", "irc_password", "=", "None", ")", ":", "if", "have_bottom", ":", "from", ".", "findall", "import", "IrcListener", "# connect and fetch current set of servers who are", "# on #electrum channel at free...
Connect to the IRC channel and find all servers presently connected. Slow; takes 30+ seconds but authoritative and current. OBSOLETE.
[ "Connect", "to", "the", "IRC", "channel", "and", "find", "all", "servers", "presently", "connected", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/svr_info.py#L180-L201
3,509
coinkite/connectrum
connectrum/svr_info.py
KnownServers.save_json
def save_json(self, fname='servers.json'): ''' Write out to a CSV file. ''' rows = sorted(self.keys()) with open(fname, 'wt') as fp: json.dump([self[k] for k in rows], fp, indent=1)
python
def save_json(self, fname='servers.json'): ''' Write out to a CSV file. ''' rows = sorted(self.keys()) with open(fname, 'wt') as fp: json.dump([self[k] for k in rows], fp, indent=1)
[ "def", "save_json", "(", "self", ",", "fname", "=", "'servers.json'", ")", ":", "rows", "=", "sorted", "(", "self", ".", "keys", "(", ")", ")", "with", "open", "(", "fname", ",", "'wt'", ")", "as", "fp", ":", "json", ".", "dump", "(", "[", "self"...
Write out to a CSV file.
[ "Write", "out", "to", "a", "CSV", "file", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/svr_info.py#L238-L244
3,510
coinkite/connectrum
connectrum/svr_info.py
KnownServers.select
def select(self, **kws): ''' Find all servers with indicated protocol support. Shuffled. Filter by TOR support, and pruning level. ''' lst = [i for i in self.values() if i.select(**kws)] random.shuffle(lst) return lst
python
def select(self, **kws): ''' Find all servers with indicated protocol support. Shuffled. Filter by TOR support, and pruning level. ''' lst = [i for i in self.values() if i.select(**kws)] random.shuffle(lst) return lst
[ "def", "select", "(", "self", ",", "*", "*", "kws", ")", ":", "lst", "=", "[", "i", "for", "i", "in", "self", ".", "values", "(", ")", "if", "i", ".", "select", "(", "*", "*", "kws", ")", "]", "random", ".", "shuffle", "(", "lst", ")", "ret...
Find all servers with indicated protocol support. Shuffled. Filter by TOR support, and pruning level.
[ "Find", "all", "servers", "with", "indicated", "protocol", "support", ".", "Shuffled", "." ]
99948f92cc5c3ecb1a8a70146294014e608e50fc
https://github.com/coinkite/connectrum/blob/99948f92cc5c3ecb1a8a70146294014e608e50fc/connectrum/svr_info.py#L249-L259
3,511
mitodl/pylti
pylti/common.py
_post_patched_request
def _post_patched_request(consumers, lti_key, body, url, method, content_type): """ Authorization header needs to be capitalized for some LTI clients this function ensures that header is capitalized :param body: body of the call :param client: OAuth Client :param url: ...
python
def _post_patched_request(consumers, lti_key, body, url, method, content_type): """ Authorization header needs to be capitalized for some LTI clients this function ensures that header is capitalized :param body: body of the call :param client: OAuth Client :param url: ...
[ "def", "_post_patched_request", "(", "consumers", ",", "lti_key", ",", "body", ",", "url", ",", "method", ",", "content_type", ")", ":", "# pylint: disable=too-many-locals, too-many-arguments", "oauth_server", "=", "LTIOAuthServer", "(", "consumers", ")", "oauth_server"...
Authorization header needs to be capitalized for some LTI clients this function ensures that header is capitalized :param body: body of the call :param client: OAuth Client :param url: outcome url :return: response
[ "Authorization", "header", "needs", "to", "be", "capitalized", "for", "some", "LTI", "clients", "this", "function", "ensures", "that", "header", "is", "capitalized" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L145-L203
3,512
mitodl/pylti
pylti/common.py
post_message
def post_message(consumers, lti_key, url, body): """ Posts a signed message to LTI consumer :param consumers: consumers from config :param lti_key: key to find appropriate consumer :param url: post url :param body: xml body :return: success """ content_type = 'application/xml' ...
python
def post_message(consumers, lti_key, url, body): """ Posts a signed message to LTI consumer :param consumers: consumers from config :param lti_key: key to find appropriate consumer :param url: post url :param body: xml body :return: success """ content_type = 'application/xml' ...
[ "def", "post_message", "(", "consumers", ",", "lti_key", ",", "url", ",", "body", ")", ":", "content_type", "=", "'application/xml'", "method", "=", "'POST'", "(", "_", ",", "content", ")", "=", "_post_patched_request", "(", "consumers", ",", "lti_key", ",",...
Posts a signed message to LTI consumer :param consumers: consumers from config :param lti_key: key to find appropriate consumer :param url: post url :param body: xml body :return: success
[ "Posts", "a", "signed", "message", "to", "LTI", "consumer" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L206-L229
3,513
mitodl/pylti
pylti/common.py
post_message2
def post_message2(consumers, lti_key, url, body, method='POST', content_type='application/xml'): """ Posts a signed message to LTI consumer using LTI 2.0 format :param: consumers: consumers from config :param: lti_key: key to find appropriate consumer :param: url: post url ...
python
def post_message2(consumers, lti_key, url, body, method='POST', content_type='application/xml'): """ Posts a signed message to LTI consumer using LTI 2.0 format :param: consumers: consumers from config :param: lti_key: key to find appropriate consumer :param: url: post url ...
[ "def", "post_message2", "(", "consumers", ",", "lti_key", ",", "url", ",", "body", ",", "method", "=", "'POST'", ",", "content_type", "=", "'application/xml'", ")", ":", "# pylint: disable=too-many-arguments", "(", "response", ",", "_", ")", "=", "_post_patched_...
Posts a signed message to LTI consumer using LTI 2.0 format :param: consumers: consumers from config :param: lti_key: key to find appropriate consumer :param: url: post url :param: body: xml body :return: success
[ "Posts", "a", "signed", "message", "to", "LTI", "consumer", "using", "LTI", "2", ".", "0", "format" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L232-L256
3,514
mitodl/pylti
pylti/common.py
verify_request_common
def verify_request_common(consumers, url, method, headers, params): """ Verifies that request is valid :param consumers: consumers from config file :param url: request url :param method: request method :param headers: request headers :param params: request params :return: is request val...
python
def verify_request_common(consumers, url, method, headers, params): """ Verifies that request is valid :param consumers: consumers from config file :param url: request url :param method: request method :param headers: request headers :param params: request params :return: is request val...
[ "def", "verify_request_common", "(", "consumers", ",", "url", ",", "method", ",", "headers", ",", "params", ")", ":", "log", ".", "debug", "(", "\"consumers %s\"", ",", "consumers", ")", "log", ".", "debug", "(", "\"url %s\"", ",", "url", ")", "log", "."...
Verifies that request is valid :param consumers: consumers from config file :param url: request url :param method: request method :param headers: request headers :param params: request params :return: is request valid
[ "Verifies", "that", "request", "is", "valid" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L259-L308
3,515
mitodl/pylti
pylti/common.py
generate_request_xml
def generate_request_xml(message_identifier_id, operation, lis_result_sourcedid, score): # pylint: disable=too-many-locals """ Generates LTI 1.1 XML for posting result to LTI consumer. :param message_identifier_id: :param operation: :param lis_result_sourcedid: :par...
python
def generate_request_xml(message_identifier_id, operation, lis_result_sourcedid, score): # pylint: disable=too-many-locals """ Generates LTI 1.1 XML for posting result to LTI consumer. :param message_identifier_id: :param operation: :param lis_result_sourcedid: :par...
[ "def", "generate_request_xml", "(", "message_identifier_id", ",", "operation", ",", "lis_result_sourcedid", ",", "score", ")", ":", "# pylint: disable=too-many-locals", "root", "=", "etree", ".", "Element", "(", "u'imsx_POXEnvelopeRequest'", ",", "xmlns", "=", "u'http:/...
Generates LTI 1.1 XML for posting result to LTI consumer. :param message_identifier_id: :param operation: :param lis_result_sourcedid: :param score: :return: XML string
[ "Generates", "LTI", "1", ".", "1", "XML", "for", "posting", "result", "to", "LTI", "consumer", "." ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L311-L353
3,516
mitodl/pylti
pylti/common.py
LTIBase.is_role
def is_role(self, role): """ Verify if user is in role :param: role: role to verify against :return: if user is in role :exception: LTIException if role is unknown """ log.debug("is_role %s", role) roles = self.session['roles'].split(',') if role ...
python
def is_role(self, role): """ Verify if user is in role :param: role: role to verify against :return: if user is in role :exception: LTIException if role is unknown """ log.debug("is_role %s", role) roles = self.session['roles'].split(',') if role ...
[ "def", "is_role", "(", "self", ",", "role", ")", ":", "log", ".", "debug", "(", "\"is_role %s\"", ",", "role", ")", "roles", "=", "self", ".", "session", "[", "'roles'", "]", ".", "split", "(", "','", ")", "if", "role", "in", "LTI_ROLES", ":", "rol...
Verify if user is in role :param: role: role to verify against :return: if user is in role :exception: LTIException if role is unknown
[ "Verify", "if", "user", "is", "in", "role" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L550-L571
3,517
mitodl/pylti
pylti/common.py
LTIBase._check_role
def _check_role(self): """ Check that user is in role specified as wrapper attribute :exception: LTIRoleException if user is not in roles """ role = u'any' if 'role' in self.lti_kwargs: role = self.lti_kwargs['role'] log.debug( "check_role...
python
def _check_role(self): """ Check that user is in role specified as wrapper attribute :exception: LTIRoleException if user is not in roles """ role = u'any' if 'role' in self.lti_kwargs: role = self.lti_kwargs['role'] log.debug( "check_role...
[ "def", "_check_role", "(", "self", ")", ":", "role", "=", "u'any'", "if", "'role'", "in", "self", ".", "lti_kwargs", ":", "role", "=", "self", ".", "lti_kwargs", "[", "'role'", "]", "log", ".", "debug", "(", "\"check_role lti_role=%s decorator_role=%s\"", ",...
Check that user is in role specified as wrapper attribute :exception: LTIRoleException if user is not in roles
[ "Check", "that", "user", "is", "in", "role", "specified", "as", "wrapper", "attribute" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L573-L586
3,518
mitodl/pylti
pylti/common.py
LTIBase.post_grade
def post_grade(self, grade): """ Post grade to LTI consumer using XML :param: grade: 0 <= grade <= 1 :return: True if post successful and grade valid :exception: LTIPostMessageException if call failed """ message_identifier_id = self.message_identifier_id() ...
python
def post_grade(self, grade): """ Post grade to LTI consumer using XML :param: grade: 0 <= grade <= 1 :return: True if post successful and grade valid :exception: LTIPostMessageException if call failed """ message_identifier_id = self.message_identifier_id() ...
[ "def", "post_grade", "(", "self", ",", "grade", ")", ":", "message_identifier_id", "=", "self", ".", "message_identifier_id", "(", ")", "operation", "=", "'replaceResult'", "lis_result_sourcedid", "=", "self", ".", "lis_result_sourcedid", "# # edX devbox fix", "score"...
Post grade to LTI consumer using XML :param: grade: 0 <= grade <= 1 :return: True if post successful and grade valid :exception: LTIPostMessageException if call failed
[ "Post", "grade", "to", "LTI", "consumer", "using", "XML" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/common.py#L588-L611
3,519
mitodl/pylti
pylti/flask.py
LTI._consumers
def _consumers(self): """ Gets consumer's map from app config :return: consumers map """ app_config = self.lti_kwargs['app'].config config = app_config.get('PYLTI_CONFIG', dict()) consumers = config.get('consumers', dict()) return consumers
python
def _consumers(self): """ Gets consumer's map from app config :return: consumers map """ app_config = self.lti_kwargs['app'].config config = app_config.get('PYLTI_CONFIG', dict()) consumers = config.get('consumers', dict()) return consumers
[ "def", "_consumers", "(", "self", ")", ":", "app_config", "=", "self", ".", "lti_kwargs", "[", "'app'", "]", ".", "config", "config", "=", "app_config", ".", "get", "(", "'PYLTI_CONFIG'", ",", "dict", "(", ")", ")", "consumers", "=", "config", ".", "ge...
Gets consumer's map from app config :return: consumers map
[ "Gets", "consumer", "s", "map", "from", "app", "config" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/flask.py#L42-L51
3,520
mitodl/pylti
pylti/flask.py
LTI.response_url
def response_url(self): """ Returns remapped lis_outcome_service_url uses PYLTI_URL_FIX map to support edX dev-stack :return: remapped lis_outcome_service_url """ url = "" url = self.session['lis_outcome_service_url'] app_config = self.lti_kwargs['app'].c...
python
def response_url(self): """ Returns remapped lis_outcome_service_url uses PYLTI_URL_FIX map to support edX dev-stack :return: remapped lis_outcome_service_url """ url = "" url = self.session['lis_outcome_service_url'] app_config = self.lti_kwargs['app'].c...
[ "def", "response_url", "(", "self", ")", ":", "url", "=", "\"\"", "url", "=", "self", ".", "session", "[", "'lis_outcome_service_url'", "]", "app_config", "=", "self", ".", "lti_kwargs", "[", "'app'", "]", ".", "config", "urls", "=", "app_config", ".", "...
Returns remapped lis_outcome_service_url uses PYLTI_URL_FIX map to support edX dev-stack :return: remapped lis_outcome_service_url
[ "Returns", "remapped", "lis_outcome_service_url", "uses", "PYLTI_URL_FIX", "map", "to", "support", "edX", "dev", "-", "stack" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/flask.py#L90-L107
3,521
mitodl/pylti
pylti/chalice.py
LTI._consumers
def _consumers(self): """ Gets consumers from Lambda environment variables prefixed with CONSUMER_KEY_SECRET_. For example, given a consumer key of foo and a shared secret of bar, you should have an environment variable CONSUMER_KEY_SECRET_foo=bar. :return: consumers map...
python
def _consumers(self): """ Gets consumers from Lambda environment variables prefixed with CONSUMER_KEY_SECRET_. For example, given a consumer key of foo and a shared secret of bar, you should have an environment variable CONSUMER_KEY_SECRET_foo=bar. :return: consumers map...
[ "def", "_consumers", "(", "self", ")", ":", "consumers", "=", "{", "}", "for", "env", "in", "os", ".", "environ", ":", "if", "env", ".", "startswith", "(", "'CONSUMER_KEY_SECRET_'", ")", ":", "key", "=", "env", "[", "20", ":", "]", "# Strip off the CON...
Gets consumers from Lambda environment variables prefixed with CONSUMER_KEY_SECRET_. For example, given a consumer key of foo and a shared secret of bar, you should have an environment variable CONSUMER_KEY_SECRET_foo=bar. :return: consumers map :raises: LTIException if environm...
[ "Gets", "consumers", "from", "Lambda", "environment", "variables", "prefixed", "with", "CONSUMER_KEY_SECRET_", ".", "For", "example", "given", "a", "consumer", "key", "of", "foo", "and", "a", "shared", "secret", "of", "bar", "you", "should", "have", "an", "env...
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/chalice.py#L50-L71
3,522
mitodl/pylti
pylti/chalice.py
LTI.verify_request
def verify_request(self): """ Verify LTI request :raises: LTIException if request validation failed """ request = self.lti_kwargs['app'].current_request if request.method == 'POST': # Chalice expects JSON and does not nativly support forms data in ...
python
def verify_request(self): """ Verify LTI request :raises: LTIException if request validation failed """ request = self.lti_kwargs['app'].current_request if request.method == 'POST': # Chalice expects JSON and does not nativly support forms data in ...
[ "def", "verify_request", "(", "self", ")", ":", "request", "=", "self", ".", "lti_kwargs", "[", "'app'", "]", ".", "current_request", "if", "request", ".", "method", "==", "'POST'", ":", "# Chalice expects JSON and does not nativly support forms data in", "# a post bo...
Verify LTI request :raises: LTIException if request validation failed
[ "Verify", "LTI", "request" ]
18a608282e0d5bc941beb2eaaeea3b7ad484b399
https://github.com/mitodl/pylti/blob/18a608282e0d5bc941beb2eaaeea3b7ad484b399/pylti/chalice.py#L73-L119
3,523
django-danceschool/django-danceschool
danceschool/core/views.py
EventRegistrationSelectView.get_queryset
def get_queryset(self): ''' Recent events are listed in link form. ''' return Event.objects.filter( Q(startTime__gte=timezone.now() - timedelta(days=90)) & ( Q(series__isnull=False) | Q(publicevent__isnull=False) ) ).annotate(count=Count('eventregistratio...
python
def get_queryset(self): ''' Recent events are listed in link form. ''' return Event.objects.filter( Q(startTime__gte=timezone.now() - timedelta(days=90)) & ( Q(series__isnull=False) | Q(publicevent__isnull=False) ) ).annotate(count=Count('eventregistratio...
[ "def", "get_queryset", "(", "self", ")", ":", "return", "Event", ".", "objects", ".", "filter", "(", "Q", "(", "startTime__gte", "=", "timezone", ".", "now", "(", ")", "-", "timedelta", "(", "days", "=", "90", ")", ")", "&", "(", "Q", "(", "series_...
Recent events are listed in link form.
[ "Recent", "events", "are", "listed", "in", "link", "form", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L53-L64
3,524
django-danceschool/django-danceschool
danceschool/core/views.py
EventRegistrationSummaryView.get_context_data
def get_context_data(self, **kwargs): ''' Add the list of registrations for the given series ''' # Update the site session data so that registration processes know to send return links to # the view class registrations page. set_return_page() is in SiteHistoryMixin. self.set_return_pag...
python
def get_context_data(self, **kwargs): ''' Add the list of registrations for the given series ''' # Update the site session data so that registration processes know to send return links to # the view class registrations page. set_return_page() is in SiteHistoryMixin. self.set_return_pag...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "# Update the site session data so that registration processes know to send return links to", "# the view class registrations page. set_return_page() is in SiteHistoryMixin.", "self", ".", "set_return_page", "(...
Add the list of registrations for the given series
[ "Add", "the", "list", "of", "registrations", "for", "the", "given", "series" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L90-L105
3,525
django-danceschool/django-danceschool
danceschool/core/views.py
SubmissionRedirectView.get_context_data
def get_context_data(self, **kwargs): ''' The URL to redirect to can be explicitly specified, or it can come from the site session history, or it can be the default admin success page as specified in the site settings. ''' context = super(SubmissionRedirectView, self).ge...
python
def get_context_data(self, **kwargs): ''' The URL to redirect to can be explicitly specified, or it can come from the site session history, or it can be the default admin success page as specified in the site settings. ''' context = super(SubmissionRedirectView, self).ge...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "super", "(", "SubmissionRedirectView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "redirect_url", "=", "unquote", "(", "self", ".", ...
The URL to redirect to can be explicitly specified, or it can come from the site session history, or it can be the default admin success page as specified in the site settings.
[ "The", "URL", "to", "redirect", "to", "can", "be", "explicitly", "specified", "or", "it", "can", "come", "from", "the", "site", "session", "history", "or", "it", "can", "be", "the", "default", "admin", "success", "page", "as", "specified", "in", "the", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L115-L140
3,526
django-danceschool/django-danceschool
danceschool/core/views.py
ViewInvoiceView.get
def get(self, request, *args, **kwargs): ''' Invoices can be viewed only if the validation string is provided, unless the user is logged in and has view_all_invoice permissions ''' user_has_validation_string = self.get_object().validationString user_has_permissions = requ...
python
def get(self, request, *args, **kwargs): ''' Invoices can be viewed only if the validation string is provided, unless the user is logged in and has view_all_invoice permissions ''' user_has_validation_string = self.get_object().validationString user_has_permissions = requ...
[ "def", "get", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "user_has_validation_string", "=", "self", ".", "get_object", "(", ")", ".", "validationString", "user_has_permissions", "=", "request", ".", "user", ".", "has_...
Invoices can be viewed only if the validation string is provided, unless the user is logged in and has view_all_invoice permissions
[ "Invoices", "can", "be", "viewed", "only", "if", "the", "validation", "string", "is", "provided", "unless", "the", "user", "is", "logged", "in", "and", "has", "view_all_invoice", "permissions" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L150-L159
3,527
django-danceschool/django-danceschool
danceschool/core/views.py
InvoiceNotificationView.dispatch
def dispatch(self, request, *args, **kwargs): ''' Get the set of invoices for which to permit notifications ''' if 'pk' in self.kwargs: try: self.invoices = Invoice.objects.filter(pk=self.kwargs.get('pk'))[:] except ValueError: raise Http404() ...
python
def dispatch(self, request, *args, **kwargs): ''' Get the set of invoices for which to permit notifications ''' if 'pk' in self.kwargs: try: self.invoices = Invoice.objects.filter(pk=self.kwargs.get('pk'))[:] except ValueError: raise Http404() ...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "'pk'", "in", "self", ".", "kwargs", ":", "try", ":", "self", ".", "invoices", "=", "Invoice", ".", "objects", ".", "filter", "(", "pk", "=...
Get the set of invoices for which to permit notifications
[ "Get", "the", "set", "of", "invoices", "for", "which", "to", "permit", "notifications" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L199-L230
3,528
django-danceschool/django-danceschool
danceschool/core/views.py
InvoiceNotificationView.get_form_kwargs
def get_form_kwargs(self): ''' Pass the set of invoices to the form for creation ''' kwargs = super(InvoiceNotificationView, self).get_form_kwargs() kwargs['invoices'] = self.toNotify return kwargs
python
def get_form_kwargs(self): ''' Pass the set of invoices to the form for creation ''' kwargs = super(InvoiceNotificationView, self).get_form_kwargs() kwargs['invoices'] = self.toNotify return kwargs
[ "def", "get_form_kwargs", "(", "self", ")", ":", "kwargs", "=", "super", "(", "InvoiceNotificationView", ",", "self", ")", ".", "get_form_kwargs", "(", ")", "kwargs", "[", "'invoices'", "]", "=", "self", ".", "toNotify", "return", "kwargs" ]
Pass the set of invoices to the form for creation
[ "Pass", "the", "set", "of", "invoices", "to", "the", "form", "for", "creation" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L232-L236
3,529
django-danceschool/django-danceschool
danceschool/core/views.py
SendEmailView.dispatch
def dispatch(self, request, *args, **kwargs): ''' If a list of customers or groups was passed, then parse it ''' ids = request.GET.get('customers') groups = request.GET.get('customergroup') self.customers = None if ids or groups: # Initial filter applies to no one bu...
python
def dispatch(self, request, *args, **kwargs): ''' If a list of customers or groups was passed, then parse it ''' ids = request.GET.get('customers') groups = request.GET.get('customergroup') self.customers = None if ids or groups: # Initial filter applies to no one bu...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "ids", "=", "request", ".", "GET", ".", "get", "(", "'customers'", ")", "groups", "=", "request", ".", "GET", ".", "get", "(", "'customergroup'", "...
If a list of customers or groups was passed, then parse it
[ "If", "a", "list", "of", "customers", "or", "groups", "was", "passed", "then", "parse", "it" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L589-L609
3,530
django-danceschool/django-danceschool
danceschool/core/views.py
SendEmailView.get_form_kwargs
def get_form_kwargs(self, **kwargs): ''' Get the list of recent months and recent series to pass to the form ''' numMonths = 12 lastStart = ( Event.objects.annotate(Min('eventoccurrence__startTime')) .order_by('-eventoccurrence__startTime__min') ...
python
def get_form_kwargs(self, **kwargs): ''' Get the list of recent months and recent series to pass to the form ''' numMonths = 12 lastStart = ( Event.objects.annotate(Min('eventoccurrence__startTime')) .order_by('-eventoccurrence__startTime__min') ...
[ "def", "get_form_kwargs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "numMonths", "=", "12", "lastStart", "=", "(", "Event", ".", "objects", ".", "annotate", "(", "Min", "(", "'eventoccurrence__startTime'", ")", ")", ".", "order_by", "(", "'-eventoccu...
Get the list of recent months and recent series to pass to the form
[ "Get", "the", "list", "of", "recent", "months", "and", "recent", "series", "to", "pass", "to", "the", "form" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L611-L652
3,531
django-danceschool/django-danceschool
danceschool/core/views.py
SendEmailView.get_initial
def get_initial(self): ''' If the user already submitted the form and decided to return from the confirmation page, then re-populate the form ''' initial = super(SendEmailView, self).get_initial() form_data = self.request.session.get(EMAIL_VALIDATION_STR, {}).get('form_d...
python
def get_initial(self): ''' If the user already submitted the form and decided to return from the confirmation page, then re-populate the form ''' initial = super(SendEmailView, self).get_initial() form_data = self.request.session.get(EMAIL_VALIDATION_STR, {}).get('form_d...
[ "def", "get_initial", "(", "self", ")", ":", "initial", "=", "super", "(", "SendEmailView", ",", "self", ")", ".", "get_initial", "(", ")", "form_data", "=", "self", ".", "request", ".", "session", ".", "get", "(", "EMAIL_VALIDATION_STR", ",", "{", "}", ...
If the user already submitted the form and decided to return from the confirmation page, then re-populate the form
[ "If", "the", "user", "already", "submitted", "the", "form", "and", "decided", "to", "return", "from", "the", "confirmation", "page", "then", "re", "-", "populate", "the", "form" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L654-L664
3,532
django-danceschool/django-danceschool
danceschool/core/views.py
SendEmailView.form_valid
def form_valid(self, form): ''' Pass form data to the confirmation view ''' form.cleaned_data.pop('template', None) self.request.session[EMAIL_VALIDATION_STR] = {'form_data': form.cleaned_data} return HttpResponseRedirect(reverse('emailConfirmation'))
python
def form_valid(self, form): ''' Pass form data to the confirmation view ''' form.cleaned_data.pop('template', None) self.request.session[EMAIL_VALIDATION_STR] = {'form_data': form.cleaned_data} return HttpResponseRedirect(reverse('emailConfirmation'))
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "form", ".", "cleaned_data", ".", "pop", "(", "'template'", ",", "None", ")", "self", ".", "request", ".", "session", "[", "EMAIL_VALIDATION_STR", "]", "=", "{", "'form_data'", ":", "form", ".", ...
Pass form data to the confirmation view
[ "Pass", "form", "data", "to", "the", "confirmation", "view" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L675-L679
3,533
django-danceschool/django-danceschool
danceschool/core/views.py
RepeatEventsView.form_valid
def form_valid(self, form): ''' For each object in the queryset, create the duplicated objects ''' startDate = form.cleaned_data.get('startDate') repeatEvery = form.cleaned_data.get('repeatEvery') periodicity = form.cleaned_data.get('periodicity') quantity = form.cleaned_data.ge...
python
def form_valid(self, form): ''' For each object in the queryset, create the duplicated objects ''' startDate = form.cleaned_data.get('startDate') repeatEvery = form.cleaned_data.get('repeatEvery') periodicity = form.cleaned_data.get('periodicity') quantity = form.cleaned_data.ge...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "startDate", "=", "form", ".", "cleaned_data", ".", "get", "(", "'startDate'", ")", "repeatEvery", "=", "form", ".", "cleaned_data", ".", "get", "(", "'repeatEvery'", ")", "periodicity", "=", "form",...
For each object in the queryset, create the duplicated objects
[ "For", "each", "object", "in", "the", "queryset", "create", "the", "duplicated", "objects" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/views.py#L934-L1013
3,534
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestList.recentEvents
def recentEvents(self): ''' Get the set of recent and upcoming events to which this list applies. ''' return Event.objects.filter( Q(pk__in=self.individualEvents.values_list('pk',flat=True)) | Q(session__in=self.eventSessions.all()) | Q(publicevent__ca...
python
def recentEvents(self): ''' Get the set of recent and upcoming events to which this list applies. ''' return Event.objects.filter( Q(pk__in=self.individualEvents.values_list('pk',flat=True)) | Q(session__in=self.eventSessions.all()) | Q(publicevent__ca...
[ "def", "recentEvents", "(", "self", ")", ":", "return", "Event", ".", "objects", ".", "filter", "(", "Q", "(", "pk__in", "=", "self", ".", "individualEvents", ".", "values_list", "(", "'pk'", ",", "flat", "=", "True", ")", ")", "|", "Q", "(", "sessio...
Get the set of recent and upcoming events to which this list applies.
[ "Get", "the", "set", "of", "recent", "and", "upcoming", "events", "to", "which", "this", "list", "applies", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L33-L45
3,535
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestList.currentEvent
def currentEvent(self): ''' Return the first event that hasn't ended yet, or if there are no future events, the last one to end. ''' currentEvent = self.recentEvents.filter(endTime__gte=timezone.now()).order_by('startTime').first() if not currentEvent: curren...
python
def currentEvent(self): ''' Return the first event that hasn't ended yet, or if there are no future events, the last one to end. ''' currentEvent = self.recentEvents.filter(endTime__gte=timezone.now()).order_by('startTime').first() if not currentEvent: curren...
[ "def", "currentEvent", "(", "self", ")", ":", "currentEvent", "=", "self", ".", "recentEvents", ".", "filter", "(", "endTime__gte", "=", "timezone", ".", "now", "(", ")", ")", ".", "order_by", "(", "'startTime'", ")", ".", "first", "(", ")", "if", "not...
Return the first event that hasn't ended yet, or if there are no future events, the last one to end.
[ "Return", "the", "first", "event", "that", "hasn", "t", "ended", "yet", "or", "if", "there", "are", "no", "future", "events", "the", "last", "one", "to", "end", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L48-L58
3,536
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestList.appliesToEvent
def appliesToEvent(self, event): ''' Check whether this guest list is applicable to an event. ''' return ( event in self.individualEvents.all() or event.session in self.eventSessions.all() or event.category in self.seriesCategories.all() or event.category ...
python
def appliesToEvent(self, event): ''' Check whether this guest list is applicable to an event. ''' return ( event in self.individualEvents.all() or event.session in self.eventSessions.all() or event.category in self.seriesCategories.all() or event.category ...
[ "def", "appliesToEvent", "(", "self", ",", "event", ")", ":", "return", "(", "event", "in", "self", ".", "individualEvents", ".", "all", "(", ")", "or", "event", ".", "session", "in", "self", ".", "eventSessions", ".", "all", "(", ")", "or", "event", ...
Check whether this guest list is applicable to an event.
[ "Check", "whether", "this", "guest", "list", "is", "applicable", "to", "an", "event", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L60-L67
3,537
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestList.getDayStart
def getDayStart(self, dateTime): ''' Ensure local time and get the beginning of the day ''' return ensure_localtime(dateTime).replace(hour=0,minute=0,second=0,microsecond=0)
python
def getDayStart(self, dateTime): ''' Ensure local time and get the beginning of the day ''' return ensure_localtime(dateTime).replace(hour=0,minute=0,second=0,microsecond=0)
[ "def", "getDayStart", "(", "self", ",", "dateTime", ")", ":", "return", "ensure_localtime", "(", "dateTime", ")", ".", "replace", "(", "hour", "=", "0", ",", "minute", "=", "0", ",", "second", "=", "0", ",", "microsecond", "=", "0", ")" ]
Ensure local time and get the beginning of the day
[ "Ensure", "local", "time", "and", "get", "the", "beginning", "of", "the", "day" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L69-L71
3,538
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestList.getListForEvent
def getListForEvent(self, event=None): ''' Get the list of names associated with a particular event. ''' names = list(self.guestlistname_set.annotate( guestType=Case( When(notes__isnull=False, then=F('notes')), default=Value(ugettext('Manually Added')), ...
python
def getListForEvent(self, event=None): ''' Get the list of names associated with a particular event. ''' names = list(self.guestlistname_set.annotate( guestType=Case( When(notes__isnull=False, then=F('notes')), default=Value(ugettext('Manually Added')), ...
[ "def", "getListForEvent", "(", "self", ",", "event", "=", "None", ")", ":", "names", "=", "list", "(", "self", ".", "guestlistname_set", ".", "annotate", "(", "guestType", "=", "Case", "(", "When", "(", "notes__isnull", "=", "False", ",", "then", "=", ...
Get the list of names associated with a particular event.
[ "Get", "the", "list", "of", "names", "associated", "with", "a", "particular", "event", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L152-L191
3,539
django-danceschool/django-danceschool
danceschool/guestlist/models.py
GuestListComponent.clean
def clean(self): ''' Either staffCategory or staffMember must be filled in, but not both. ''' if not self.staffCategory and not self.staffMember: raise ValidationError(_('Either staff category or staff member must be specified.')) if self.staffCategory and self.staffMember: ...
python
def clean(self): ''' Either staffCategory or staffMember must be filled in, but not both. ''' if not self.staffCategory and not self.staffMember: raise ValidationError(_('Either staff category or staff member must be specified.')) if self.staffCategory and self.staffMember: ...
[ "def", "clean", "(", "self", ")", ":", "if", "not", "self", ".", "staffCategory", "and", "not", "self", ".", "staffMember", ":", "raise", "ValidationError", "(", "_", "(", "'Either staff category or staff member must be specified.'", ")", ")", "if", "self", ".",...
Either staffCategory or staffMember must be filled in, but not both.
[ "Either", "staffCategory", "or", "staffMember", "must", "be", "filled", "in", "but", "not", "both", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/guestlist/models.py#L237-L242
3,540
django-danceschool/django-danceschool
danceschool/core/ajax.py
updateSeriesAttributes
def updateSeriesAttributes(request): ''' This function handles the filtering of available series classes and seriesteachers when a series is chosen on the Substitute Teacher reporting form. ''' if request.method == 'POST' and request.POST.get('event'): series_option = request.POST.get(...
python
def updateSeriesAttributes(request): ''' This function handles the filtering of available series classes and seriesteachers when a series is chosen on the Substitute Teacher reporting form. ''' if request.method == 'POST' and request.POST.get('event'): series_option = request.POST.get(...
[ "def", "updateSeriesAttributes", "(", "request", ")", ":", "if", "request", ".", "method", "==", "'POST'", "and", "request", ".", "POST", ".", "get", "(", "'event'", ")", ":", "series_option", "=", "request", ".", "POST", ".", "get", "(", "'event'", ")",...
This function handles the filtering of available series classes and seriesteachers when a series is chosen on the Substitute Teacher reporting form.
[ "This", "function", "handles", "the", "filtering", "of", "available", "series", "classes", "and", "seriesteachers", "when", "a", "series", "is", "chosen", "on", "the", "Substitute", "Teacher", "reporting", "form", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L54-L78
3,541
django-danceschool/django-danceschool
danceschool/core/ajax.py
processCheckIn
def processCheckIn(request): ''' This function handles the Ajax call made when a user is marked as checked in ''' if request.method == 'POST': event_id = request.POST.get('event_id') reg_ids = request.POST.getlist('reg_id') if not event_id: return HttpResp...
python
def processCheckIn(request): ''' This function handles the Ajax call made when a user is marked as checked in ''' if request.method == 'POST': event_id = request.POST.get('event_id') reg_ids = request.POST.getlist('reg_id') if not event_id: return HttpResp...
[ "def", "processCheckIn", "(", "request", ")", ":", "if", "request", ".", "method", "==", "'POST'", ":", "event_id", "=", "request", ".", "POST", ".", "get", "(", "'event_id'", ")", "reg_ids", "=", "request", ".", "POST", ".", "getlist", "(", "'reg_id'", ...
This function handles the Ajax call made when a user is marked as checked in
[ "This", "function", "handles", "the", "Ajax", "call", "made", "when", "a", "user", "is", "marked", "as", "checked", "in" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/ajax.py#L81-L103
3,542
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
3,543
django-danceschool/django-danceschool
danceschool/vouchers/views.py
GiftCertificateCustomizeView.dispatch
def dispatch(self,request,*args,**kwargs): ''' Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid. ''' paymentSession = request.session.get(INVOICE_VALIDATION_STR, {}) self.invoiceID = paymentSession.get('invoiceID') ...
python
def dispatch(self,request,*args,**kwargs): ''' Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid. ''' paymentSession = request.session.get(INVOICE_VALIDATION_STR, {}) self.invoiceID = paymentSession.get('invoiceID') ...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "paymentSession", "=", "request", ".", "session", ".", "get", "(", "INVOICE_VALIDATION_STR", ",", "{", "}", ")", "self", ".", "invoiceID", "=", "paymen...
Check that a valid Invoice ID has been passed in session data, and that said invoice is marked as paid.
[ "Check", "that", "a", "valid", "Invoice", "ID", "has", "been", "passed", "in", "session", "data", "and", "that", "said", "invoice", "is", "marked", "as", "paid", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/views.py#L31-L50
3,544
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
3,545
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
3,546
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
3,547
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
3,548
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
3,549
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
3,550
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
3,551
django-danceschool/django-danceschool
danceschool/financial/views.py
CompensationActionView.get_form_kwargs
def get_form_kwargs(self, **kwargs): ''' pass the list of staff members along to the form ''' kwargs = super(CompensationActionView, self).get_form_kwargs(**kwargs) kwargs['staffmembers'] = self.queryset return kwargs
python
def get_form_kwargs(self, **kwargs): ''' pass the list of staff members along to the form ''' kwargs = super(CompensationActionView, self).get_form_kwargs(**kwargs) kwargs['staffmembers'] = self.queryset return kwargs
[ "def", "get_form_kwargs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "super", "(", "CompensationActionView", ",", "self", ")", ".", "get_form_kwargs", "(", "*", "*", "kwargs", ")", "kwargs", "[", "'staffmembers'", "]", "=", "self", "....
pass the list of staff members along to the form
[ "pass", "the", "list", "of", "staff", "members", "along", "to", "the", "form" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/views.py#L631-L635
3,552
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
3,553
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
3,554
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
3,555
django-danceschool/django-danceschool
danceschool/private_lessons/handlers.py
finalizePrivateLessonRegistration
def finalizePrivateLessonRegistration(sender,**kwargs): ''' Once a private lesson registration is finalized, mark the slots that were used to book the private lesson as booked and associate them with the final registration. No need to notify students in this instance because they are already r...
python
def finalizePrivateLessonRegistration(sender,**kwargs): ''' Once a private lesson registration is finalized, mark the slots that were used to book the private lesson as booked and associate them with the final registration. No need to notify students in this instance because they are already r...
[ "def", "finalizePrivateLessonRegistration", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "finalReg", "=", "kwargs", ".", "pop", "(", "'registration'", ")", "for", "er", "in", "finalReg", ".", "eventregistration_set", ".", "filter", "(", "event__privatelesso...
Once a private lesson registration is finalized, mark the slots that were used to book the private lesson as booked and associate them with the final registration. No need to notify students in this instance because they are already receiving a notification of their registration.
[ "Once", "a", "private", "lesson", "registration", "is", "finalized", "mark", "the", "slots", "that", "were", "used", "to", "book", "the", "private", "lesson", "as", "booked", "and", "associate", "them", "with", "the", "final", "registration", ".", "No", "nee...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/private_lessons/handlers.py#L6-L19
3,556
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
3,557
django-danceschool/django-danceschool
danceschool/financial/admin.py
RepeatedExpenseRuleChildAdmin.get_fieldsets
def get_fieldsets(self, request, obj=None): ''' Override polymorphic default to put the subclass-specific fields first ''' # If subclass declares fieldsets, this is respected if (hasattr(self, 'declared_fieldset') and self.declared_fieldsets) \ or not self.base_fieldsets: ...
python
def get_fieldsets(self, request, obj=None): ''' Override polymorphic default to put the subclass-specific fields first ''' # If subclass declares fieldsets, this is respected if (hasattr(self, 'declared_fieldset') and self.declared_fieldsets) \ or not self.base_fieldsets: ...
[ "def", "get_fieldsets", "(", "self", ",", "request", ",", "obj", "=", "None", ")", ":", "# If subclass declares fieldsets, this is respected", "if", "(", "hasattr", "(", "self", ",", "'declared_fieldset'", ")", "and", "self", ".", "declared_fieldsets", ")", "or", ...
Override polymorphic default to put the subclass-specific fields first
[ "Override", "polymorphic", "default", "to", "put", "the", "subclass", "-", "specific", "fields", "first" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/admin.py#L427-L441
3,558
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
3,559
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
3,560
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
3,561
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
3,562
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
3,563
django-danceschool/django-danceschool
danceschool/core/classreg.py
ClassRegistrationView.dispatch
def dispatch(self, request, *args, **kwargs): ''' Check that registration is online before proceeding. If this is a POST request, determine whether the response should be provided in JSON form. ''' self.returnJson = (request.POST.get('json') in ['true', True]) regonline...
python
def dispatch(self, request, *args, **kwargs): ''' Check that registration is online before proceeding. If this is a POST request, determine whether the response should be provided in JSON form. ''' self.returnJson = (request.POST.get('json') in ['true', True]) regonline...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "self", ".", "returnJson", "=", "(", "request", ".", "POST", ".", "get", "(", "'json'", ")", "in", "[", "'true'", ",", "True", "]", ")", "regonli...
Check that registration is online before proceeding. If this is a POST request, determine whether the response should be provided in JSON form.
[ "Check", "that", "registration", "is", "online", "before", "proceeding", ".", "If", "this", "is", "a", "POST", "request", "determine", "whether", "the", "response", "should", "be", "provided", "in", "JSON", "form", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L65-L80
3,564
django-danceschool/django-danceschool
danceschool/core/classreg.py
ClassRegistrationView.get_context_data
def get_context_data(self,**kwargs): ''' Add the event and series listing data ''' context = self.get_listing() context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all' context.update(kwargs) # Update the site session data so that registration p...
python
def get_context_data(self,**kwargs): ''' Add the event and series listing data ''' context = self.get_listing() context['showDescriptionRule'] = getConstant('registration__showDescriptionRule') or 'all' context.update(kwargs) # Update the site session data so that registration p...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context", "=", "self", ".", "get_listing", "(", ")", "context", "[", "'showDescriptionRule'", "]", "=", "getConstant", "(", "'registration__showDescriptionRule'", ")", "or", "'all'", "...
Add the event and series listing data
[ "Add", "the", "event", "and", "series", "listing", "data" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L82-L92
3,565
django-danceschool/django-danceschool
danceschool/core/classreg.py
ClassRegistrationView.get_form_kwargs
def get_form_kwargs(self, **kwargs): ''' Tell the form which fields to render ''' kwargs = super(ClassRegistrationView, self).get_form_kwargs(**kwargs) kwargs['user'] = self.request.user if hasattr(self.request,'user') else None listing = self.get_listing() kwargs.update({ ...
python
def get_form_kwargs(self, **kwargs): ''' Tell the form which fields to render ''' kwargs = super(ClassRegistrationView, self).get_form_kwargs(**kwargs) kwargs['user'] = self.request.user if hasattr(self.request,'user') else None listing = self.get_listing() kwargs.update({ ...
[ "def", "get_form_kwargs", "(", "self", ",", "*", "*", "kwargs", ")", ":", "kwargs", "=", "super", "(", "ClassRegistrationView", ",", "self", ")", ".", "get_form_kwargs", "(", "*", "*", "kwargs", ")", "kwargs", "[", "'user'", "]", "=", "self", ".", "req...
Tell the form which fields to render
[ "Tell", "the", "form", "which", "fields", "to", "render" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L94-L105
3,566
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
3,567
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
3,568
django-danceschool/django-danceschool
danceschool/core/classreg.py
RegistrationSummaryView.dispatch
def dispatch(self,request,*args,**kwargs): ''' Always check that the temporary registration has not expired ''' regSession = self.request.session.get(REG_VALIDATION_STR,{}) if not regSession: return HttpResponseRedirect(reverse('registration')) try: reg = Tempor...
python
def dispatch(self,request,*args,**kwargs): ''' Always check that the temporary registration has not expired ''' regSession = self.request.session.get(REG_VALIDATION_STR,{}) if not regSession: return HttpResponseRedirect(reverse('registration')) try: reg = Tempor...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "regSession", "=", "self", ".", "request", ".", "session", ".", "get", "(", "REG_VALIDATION_STR", ",", "{", "}", ")", "if", "not", "regSession", ":",...
Always check that the temporary registration has not expired
[ "Always", "check", "that", "the", "temporary", "registration", "has", "not", "expired" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L321-L347
3,569
django-danceschool/django-danceschool
danceschool/core/classreg.py
RegistrationSummaryView.get_context_data
def get_context_data(self,**kwargs): ''' Pass the initial kwargs, then update with the needed registration info. ''' context_data = super(RegistrationSummaryView,self).get_context_data(**kwargs) regSession = self.request.session[REG_VALIDATION_STR] reg_id = regSession["temp_reg_id"] ...
python
def get_context_data(self,**kwargs): ''' Pass the initial kwargs, then update with the needed registration info. ''' context_data = super(RegistrationSummaryView,self).get_context_data(**kwargs) regSession = self.request.session[REG_VALIDATION_STR] reg_id = regSession["temp_reg_id"] ...
[ "def", "get_context_data", "(", "self", ",", "*", "*", "kwargs", ")", ":", "context_data", "=", "super", "(", "RegistrationSummaryView", ",", "self", ")", ".", "get_context_data", "(", "*", "*", "kwargs", ")", "regSession", "=", "self", ".", "request", "."...
Pass the initial kwargs, then update with the needed registration info.
[ "Pass", "the", "initial", "kwargs", "then", "update", "with", "the", "needed", "registration", "info", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L440-L492
3,570
django-danceschool/django-danceschool
danceschool/core/classreg.py
StudentInfoView.dispatch
def dispatch(self, request, *args, **kwargs): ''' Require session data to be set to proceed, otherwise go back to step 1. Because they have the same expiration date, this also implies that the TemporaryRegistration object is not yet expired. ''' if REG_VALIDATION_STR not ...
python
def dispatch(self, request, *args, **kwargs): ''' Require session data to be set to proceed, otherwise go back to step 1. Because they have the same expiration date, this also implies that the TemporaryRegistration object is not yet expired. ''' if REG_VALIDATION_STR not ...
[ "def", "dispatch", "(", "self", ",", "request", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "if", "REG_VALIDATION_STR", "not", "in", "request", ".", "session", ":", "return", "HttpResponseRedirect", "(", "reverse", "(", "'registration'", ")", ")",...
Require session data to be set to proceed, otherwise go back to step 1. Because they have the same expiration date, this also implies that the TemporaryRegistration object is not yet expired.
[ "Require", "session", "data", "to", "be", "set", "to", "proceed", "otherwise", "go", "back", "to", "step", "1", ".", "Because", "they", "have", "the", "same", "expiration", "date", "this", "also", "implies", "that", "the", "TemporaryRegistration", "object", ...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L557-L581
3,571
django-danceschool/django-danceschool
danceschool/core/classreg.py
StudentInfoView.form_valid
def form_valid(self,form): ''' Even if this form is valid, the handlers for this form may have added messages to the request. In that case, then the page should be handled as if the form were invalid. Otherwise, update the session data with the form data and then move to the ne...
python
def form_valid(self,form): ''' Even if this form is valid, the handlers for this form may have added messages to the request. In that case, then the page should be handled as if the form were invalid. Otherwise, update the session data with the form data and then move to the ne...
[ "def", "form_valid", "(", "self", ",", "form", ")", ":", "reg", "=", "self", ".", "temporaryRegistration", "# The session expires after a period of inactivity that is specified in preferences.", "expiry", "=", "timezone", ".", "now", "(", ")", "+", "timedelta", "(", "...
Even if this form is valid, the handlers for this form may have added messages to the request. In that case, then the page should be handled as if the form were invalid. Otherwise, update the session data with the form data and then move to the next view
[ "Even", "if", "this", "form", "is", "valid", "the", "handlers", "for", "this", "form", "may", "have", "added", "messages", "to", "the", "request", ".", "In", "that", "case", "then", "the", "page", "should", "be", "handled", "as", "if", "the", "form", "...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/classreg.py#L666-L699
3,572
django-danceschool/django-danceschool
danceschool/core/handlers.py
linkUserToMostRecentCustomer
def linkUserToMostRecentCustomer(sender,**kwargs): ''' If a new primary email address has just been confirmed, check if the user associated with that email has an associated customer object yet. If not, then look for the customer with that email address who most recently registered for something an...
python
def linkUserToMostRecentCustomer(sender,**kwargs): ''' If a new primary email address has just been confirmed, check if the user associated with that email has an associated customer object yet. If not, then look for the customer with that email address who most recently registered for something an...
[ "def", "linkUserToMostRecentCustomer", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "email_address", "=", "kwargs", ".", "get", "(", "'email_address'", ",", "None", ")", "if", "not", "email_address", "or", "not", "email_address", ".", "primary", "or", "...
If a new primary email address has just been confirmed, check if the user associated with that email has an associated customer object yet. If not, then look for the customer with that email address who most recently registered for something and that is not associated with another user. Automatically a...
[ "If", "a", "new", "primary", "email", "address", "has", "just", "been", "confirmed", "check", "if", "the", "user", "associated", "with", "that", "email", "has", "an", "associated", "customer", "object", "yet", ".", "If", "not", "then", "look", "for", "the"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/core/handlers.py#L17-L51
3,573
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
3,574
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
3,575
django-danceschool/django-danceschool
danceschool/banlist/handlers.py
checkBanlist
def checkBanlist(sender, **kwargs): ''' Check that this individual is not on the ban list. ''' if not getConstant('registration__enableBanList'): return logger.debug('Signal to check RegistrationContactForm handled by banlist app.') formData = kwargs.get('formData', {}) ...
python
def checkBanlist(sender, **kwargs): ''' Check that this individual is not on the ban list. ''' if not getConstant('registration__enableBanList'): return logger.debug('Signal to check RegistrationContactForm handled by banlist app.') formData = kwargs.get('formData', {}) ...
[ "def", "checkBanlist", "(", "sender", ",", "*", "*", "kwargs", ")", ":", "if", "not", "getConstant", "(", "'registration__enableBanList'", ")", ":", "return", "logger", ".", "debug", "(", "'Signal to check RegistrationContactForm handled by banlist app.'", ")", "formD...
Check that this individual is not on the ban list.
[ "Check", "that", "this", "individual", "is", "not", "on", "the", "ban", "list", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/banlist/handlers.py#L35-L105
3,576
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
3,577
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
3,578
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
3,579
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
3,580
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
3,581
django-danceschool/django-danceschool
danceschool/financial/models.py
ExpenseItem.save
def save(self, *args, **kwargs): ''' This custom save method ensures that an expense is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of expense of that series or event. ''' # Set the approv...
python
def save(self, *args, **kwargs): ''' This custom save method ensures that an expense is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of expense of that series or event. ''' # Set the approv...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Set the approval and payment dates if they have just been approved/paid.", "if", "not", "hasattr", "(", "self", ",", "'__paid'", ")", "or", "not", "hasattr", "(", "self", ",", ...
This custom save method ensures that an expense is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of expense of that series or event.
[ "This", "custom", "save", "method", "ensures", "that", "an", "expense", "is", "not", "attributed", "to", "multiple", "categories", ".", "It", "also", "ensures", "that", "the", "series", "and", "event", "properties", "are", "always", "associated", "with", "any"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L724-L796
3,582
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
3,583
django-danceschool/django-danceschool
danceschool/financial/models.py
RevenueItem.save
def save(self, *args, **kwargs): ''' This custom save method ensures that a revenue item is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of revenue of that series or event. ''' # Set the r...
python
def save(self, *args, **kwargs): ''' This custom save method ensures that a revenue item is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of revenue of that series or event. ''' # Set the r...
[ "def", "save", "(", "self", ",", "*", "args", ",", "*", "*", "kwargs", ")", ":", "# Set the received date if the payment was just marked received", "if", "not", "hasattr", "(", "self", ",", "'__received'", ")", ":", "if", "self", ".", "received", "and", "not",...
This custom save method ensures that a revenue item is not attributed to multiple categories. It also ensures that the series and event properties are always associated with any type of revenue of that series or event.
[ "This", "custom", "save", "method", "ensures", "that", "a", "revenue", "item", "is", "not", "attributed", "to", "multiple", "categories", ".", "It", "also", "ensures", "that", "the", "series", "and", "event", "properties", "are", "always", "associated", "with"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/models.py#L891-L949
3,584
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
3,585
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
3,586
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
3,587
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
3,588
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
3,589
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
3,590
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
3,591
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
3,592
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
3,593
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
3,594
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
3,595
django-danceschool/django-danceschool
danceschool/vouchers/models.py
Voucher.create_new_code
def create_new_code(cls,**kwargs): ''' Creates a new Voucher with a unique voucherId ''' prefix = kwargs.pop('prefix','') new = False while not new: # Standard is a ten-letter random string of uppercase letters random_string = ''.join(random.choic...
python
def create_new_code(cls,**kwargs): ''' Creates a new Voucher with a unique voucherId ''' prefix = kwargs.pop('prefix','') new = False while not new: # Standard is a ten-letter random string of uppercase letters random_string = ''.join(random.choic...
[ "def", "create_new_code", "(", "cls", ",", "*", "*", "kwargs", ")", ":", "prefix", "=", "kwargs", ".", "pop", "(", "'prefix'", ",", "''", ")", "new", "=", "False", "while", "not", "new", ":", "# Standard is a ten-letter random string of uppercase letters", "ra...
Creates a new Voucher with a unique voucherId
[ "Creates", "a", "new", "Voucher", "with", "a", "unique", "voucherId" ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/vouchers/models.py#L66-L79
3,596
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
3,597
django-danceschool/django-danceschool
danceschool/financial/handlers.py
updateTransactionParty
def updateTransactionParty(sender,instance,**kwargs): ''' If a User, StaffMember, or Location is updated, and there exists an associated TransactionParty, then the name and other attributes of that party should be updated to reflect the new information. ''' if 'loaddata' in sys.argv or (...
python
def updateTransactionParty(sender,instance,**kwargs): ''' If a User, StaffMember, or Location is updated, and there exists an associated TransactionParty, then the name and other attributes of that party should be updated to reflect the new information. ''' if 'loaddata' in sys.argv or (...
[ "def", "updateTransactionParty", "(", "sender", ",", "instance", ",", "*", "*", "kwargs", ")", ":", "if", "'loaddata'", "in", "sys", ".", "argv", "or", "(", "'raw'", "in", "kwargs", "and", "kwargs", "[", "'raw'", "]", ")", ":", "return", "logger", ".",...
If a User, StaffMember, or Location is updated, and there exists an associated TransactionParty, then the name and other attributes of that party should be updated to reflect the new information.
[ "If", "a", "User", "StaffMember", "or", "Location", "is", "updated", "and", "there", "exists", "an", "associated", "TransactionParty", "then", "the", "name", "and", "other", "attributes", "of", "that", "party", "should", "be", "updated", "to", "reflect", "the"...
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/financial/handlers.py#L151-L165
3,598
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
3,599
django-danceschool/django-danceschool
danceschool/stats/stats.py
getClassTypeMonthlyData
def getClassTypeMonthlyData(year=None, series=None, typeLimit=None): ''' To break out by class type and month simultaneously, get data for each series and aggregate by class type. ''' # If no year specified, report current year to date. if not year: year = timezone.now().year role_...
python
def getClassTypeMonthlyData(year=None, series=None, typeLimit=None): ''' To break out by class type and month simultaneously, get data for each series and aggregate by class type. ''' # If no year specified, report current year to date. if not year: year = timezone.now().year role_...
[ "def", "getClassTypeMonthlyData", "(", "year", "=", "None", ",", "series", "=", "None", ",", "typeLimit", "=", "None", ")", ":", "# If no year specified, report current year to date.", "if", "not", "year", ":", "year", "=", "timezone", ".", "now", "(", ")", "....
To break out by class type and month simultaneously, get data for each series and aggregate by class type.
[ "To", "break", "out", "by", "class", "type", "and", "month", "simultaneously", "get", "data", "for", "each", "series", "and", "aggregate", "by", "class", "type", "." ]
bb08cbf39017a812a5a94bdb4ea34170bf1a30ba
https://github.com/django-danceschool/django-danceschool/blob/bb08cbf39017a812a5a94bdb4ea34170bf1a30ba/danceschool/stats/stats.py#L138-L211