Skip to content

Instantly share code, notes, and snippets.

@BlackPie
BlackPie / 1script.py
Last active February 5, 2018 08:17
Invoice generation
import datetime
#date_from = datetime.datetime(year=2017,day=1,month=10)
#date_to = datetime.datetime(year=2017,day=14,month=10)
date_from = datetime.datetime(year=2016,day=10,month=12)
InvoiceLine.objects.all().delete()
Invoice.objects.all().delete()
#contact = Contact.objects.filter(first_name='Justin', last_name='Ward').first()
#cc = CandidateContact.objects.filter(contact=contact).first()
#timesheets = TimeSheet.objects.filter(vacancy_offer__candidate_contact=cc).filter(shift_started_at__gte=date_from).filter(shift_started_at__lte=date_to)
@BlackPie
BlackPie / template.html
Created June 28, 2016 09:23 — forked from imkevinxu/template.html
Django code to read uploaded CSV file
<form action="{% url %}" method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="csv_file" />
<input type="submit" value="Upload" />
</form>
{% extends "base/base.html" %}
{% block content %}
<h1>Leaderboard</h1>
<br><br><br>
<h2>Total tree pledge</h2>
<ol>
{% for profile in tree_pledges_toplist %}
<li>{{ profile.user.username}} - {{ profile.total_tree_pledges}}</li>
{% endfor %}