This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: "3.1" | |
services: | |
db: | |
image: mysql:5.7 | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always | |
volumes: | |
- db_data:/var/lib/mysql | |
environment: | |
MYSQL_ROOT_PASSWORD: ROOT_PASSWORD |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from PIL import Image | |
import struct | |
import sys | |
def r8(f): | |
return ord(f.read(1)) | |
if len(sys.argv) < 3: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys, os | |
cwd = os.getcwd() | |
sys.path.append(cwd) | |
sys.path.append(cwd + '/my_django_project') | |
INTERP = os.path.expanduser("~/.virtualenvs/my_django_project/bin/python3") | |
if sys.executable != INTERP: os.execl(INTERP, INTERP, *sys.argv) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function updateFormElementIndices(formClass) { | |
var forms = $('.' + formClass); | |
forms.each(function(i, el) { | |
var curIndex = $(el).attr('id').match(/\d+/)[0]; | |
$(el).attr('id', $(el).attr('id').replace(curIndex, i)); | |
var inputs = $(el).find('.' + formClass + 'Input'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function deleteLeaveRow(deleteLink) { | |
var totalFormsField = $('#id_form-TOTAL_FORMS'); | |
var totalForms = parseInt(totalFormsField.val()) - 1; | |
totalFormsField.val(totalForms); | |
$(deleteLink).closest('.leaveForm').remove(); | |
// for formset functionality to work properly, need to update all existing form ids so they're sequential | |
updateFormElementIndices('leaveForm'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a href="javascript:void(0);" onclick="deleteLeaveRow(this);" class="remove muted pull-right"> | |
<div class="fa fa-times fa-lg" title="Delete day off" alt="Delete day off"></div><span class="visible-xs">Remove Day</span> | |
</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="leaveForm{{ form_num }}" class="row row-tall row-bottom-border leaveForm"> | |
<div class="form-group col-sm-4"> | |
<div class="row"> | |
<div class="col-xs-8"> | |
<label for="id_form-{{ form_num }}-date_start" class="sr-only">From</label> | |
<div class="input-group{% if leave_form.date_start.errors %} has-error{% endif %}"> | |
<span class="input-group-addon addon-small hidden-sm"><i class="fa fa-calendar"></i></span> | |
<input id="id_form-{{ form_num }}-date_start" name="form-{{ form_num }}-date_start" class="datepicker form-control input-sm leaveFormInput" placeholder="mm/dd/yyyy" type="text" value="{{ leave_form.date_start.value|default_if_none:'' }}" /> | |
{% if leave_form.date_start.errors %} | |
<span class="input-group-addon addon-small"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addLeaveRow() { | |
var totalFormsField = $('#id_form-TOTAL_FORMS'); | |
var nextFormNum = parseInt(totalFormsField.val()); | |
$('#add_leave_row').addClass('disabled'); | |
$('#loading').show(); | |
$.ajax({ | |
url: '/leave/leave-form/' + nextFormNum + '/', | |
type: 'GET' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import csv | |
from django.http import HttpResponse | |
# other imports here ... | |
@login_required | |
def registrant_email_dump(request): | |
response = HttpResponse(content_type='text/csv') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class SponsorManager(models.Manager): | |
def with_sponsorship_totals(self): | |
from django.db import connection | |
cursor = connection.cursor() | |
cursor.execute(""" | |
SELECT s.id, | |
s.registrant_sponsoring_id, | |
SUM(s.sponsorship_amount) AS total_sponsorship_amount, | |
r.first_name, |
NewerOlder