Esempio n. 1
0
def disbursements():
	disbursements = Disbursement.objects.filter(meta_data__processed=True)
	filename = "InfluenceExplorer/disbursements.csv"
	disbursement_file = default_storage.open(filename, 'wb')
	writer = UnicodeWriter(disbursement_file)
	writer.writerow(disbursement_heading)
	disbursements_sheet(disbursements, writer)
	disbursement_file.close()
	print "done with disbursements"
Esempio n. 2
0
def contributions():
	contributions = Contribution.objects.filter(meta_data__processed=True)
	filename = "InfluenceExplorer/contributions.csv"
	contribution_file = default_storage.open(filename, 'wb')
	writer = UnicodeWriter(contribution_file)
	writer.writerow(contribution_heading)
	contributions_sheet(contributions, writer)
	contribution_file.close()
	print "done with contributions"
Esempio n. 3
0
def contributions():
    contributions = Contribution.objects.filter(meta_data__processed=True)
    filename = "InfluenceExplorer/contributions.csv"
    contribution_file = default_storage.open(filename, 'wb')
    writer = UnicodeWriter(contribution_file)
    writer.writerow(contribution_heading)
    contributions_sheet(contributions, writer)
    contribution_file.close()
    print "done with contributions"
Esempio n. 4
0
def payments():
	payments = Payment.objects.filter(meta_data__processed=True)
	filename = "InfluenceExplorer/payments.csv"
	payment_file = default_storage.open(filename, 'wb')
	writer = UnicodeWriter(payment_file)
	writer.writerow(payment_heading)
	payments_sheet(payments, writer)
	payment_file.close()
	print "done with payments"
Esempio n. 5
0
def disbursements():
    disbursements = Disbursement.objects.filter(meta_data__processed=True)
    filename = "InfluenceExplorer/disbursements.csv"
    disbursement_file = default_storage.open(filename, 'wb')
    writer = UnicodeWriter(disbursement_file)
    writer.writerow(disbursement_heading)
    disbursements_sheet(disbursements, writer)
    disbursement_file.close()
    print "done with disbursements"
Esempio n. 6
0
def payments():
    payments = Payment.objects.filter(meta_data__processed=True)
    filename = "InfluenceExplorer/payments.csv"
    payment_file = default_storage.open(filename, 'wb')
    writer = UnicodeWriter(payment_file)
    writer.writerow(payment_heading)
    payments_sheet(payments, writer)
    payment_file.close()
    print "done with payments"
Esempio n. 7
0
def make_contributions(docs):
	links = []
	for d in docs:
		if d.processed == True:
			links.append(d.url)
	contributions = Contribution.objects.filter(link__in=links) 
		
	if len(contributions) >=1:
		filename = "contributions.csv"
		writer = UnicodeWriter(open(filename, 'wb'))
		writer.writerow(contribution_heading)
		contributions_sheet(contributions, writer)
		return filename
	else: return None
Esempio n. 8
0
def make_disbursements(docs):
	links = []
	for d in docs:
		if d.processed == True:
			links.append(d.url)
	disbursements = Disbursement.objects.filter(link__in=links)

	if len(disbursements) >=1:
		filename = "disbursements.csv"
		writer = UnicodeWriter(open(filename, 'wb'))
		writer.writerow(disbursement_heading)
		disbursements_sheet(disbursements, writer)
		return filename
	else: return None
Esempio n. 9
0
def make_contacts(docs):
	links = []
	for d in docs:
		if d.processed == True:
			links.append(d.url)
	contacts = Contact.objects.filter(link__in=links) 

	if len(contacts) >= 1:
		filename = "contacts.csv"
		contact_file = open(filename, 'wb')
		writer = UnicodeWriter(contact_file)
		writer.writerow(contact_heading)
		contact_sheet(contacts, writer)
		return filename
	else: return None
Esempio n. 10
0
def make_disbursements(docs):
    links = []
    for d in docs:
        if d.processed == True:
            links.append(d.url)
    disbursements = Disbursement.objects.filter(link__in=links)

    if len(disbursements) >= 1:
        filename = "disbursements.csv"
        writer = UnicodeWriter(open(filename, 'wb'))
        writer.writerow(disbursement_heading)
        disbursements_sheet(disbursements, writer)
        return filename
    else:
        return None
Esempio n. 11
0
def make_contributions(docs):
    links = []
    for d in docs:
        if d.processed == True:
            links.append(d.url)
    contributions = Contribution.objects.filter(link__in=links)

    if len(contributions) >= 1:
        filename = "contributions.csv"
        writer = UnicodeWriter(open(filename, 'wb'))
        writer.writerow(contribution_heading)
        contributions_sheet(contributions, writer)
        return filename
    else:
        return None
Esempio n. 12
0
def create_contact():
    pool = Contact.objects.filter(meta_data__processed=True)
    paginated_contacts = Paginator(pool, 500)
    page_range = paginated_contacts.page_range

    filename = "InfluenceExplorer/contacts.csv"
    with default_storage.open(filename, 'wb') as contact_file:
        writer = UnicodeWriter(contact_file)
        writer.writerow(contact_heading)
        # this was paginated to avoid horrendous garbage cleanup when I passes it all at once
        for n in page_range:
            contacts = paginated_contacts.page(n)
            contact_sheet(contacts, writer)

    print "done with contacts"
Esempio n. 13
0
def create_contact():
	pool = Contact.objects.filter(meta_data__processed=True)
	paginated_contacts = Paginator(pool, 500)
	page_range = paginated_contacts.page_range

	filename = "InfluenceExplorer/contacts.csv"
	with default_storage.open(filename, 'wb') as contact_file:
		writer = UnicodeWriter(contact_file)
		writer.writerow(contact_heading)
		# this was paginated to avoid horrendous garbage cleanup when I passes it all at once
		for n in page_range:
			contacts = paginated_contacts.page(n)
			contact_sheet(contacts, writer)

	print "done with contacts"
Esempio n. 14
0
def make_contacts(docs):
    links = []
    for d in docs:
        if d.processed == True:
            links.append(d.url)
    contacts = Contact.objects.filter(link__in=links)

    if len(contacts) >= 1:
        filename = "contacts.csv"
        contact_file = open(filename, 'wb')
        writer = UnicodeWriter(contact_file)
        writer.writerow(contact_heading)
        contact_sheet(contacts, writer)
        return filename
    else:
        return None
Esempio n. 15
0
def client_reg():
    filename = "InfluenceExplorer/client_registrant.csv"
    cr_file = default_storage.open(filename, 'wb')
    writer = UnicodeWriter(cr_file)
    client_registrant(writer)
    cr_file.close()
    print "done with client registrant"
Esempio n. 16
0
	def handle(self, *args, **options):
		print "starting", datetime.datetime.now().time()
		
		#contacts
		contacts = list(Contact.objects.filter(meta_data__processed=True))
		print "got contacts"
		filename = "InfluenceExplorer/contacts.csv"
		contact_file = default_storage.open(filename, 'wb')
		writer = UnicodeWriter(contact_file)
		writer.writerow(contact_heading)
		print 'starting contacts'
		contact_sheet(contacts, writer)
		print "done looping"
		contact_file.close()
		print "done with contacts"

		# client-registrant
		filename = "InfluenceExplorer/client_registrant.csv"
		cr_file = default_storage.open(filename, 'wb')
		writer = UnicodeWriter(cr_file)
		client_registrant(writer)
		cr_file.close()
		print "done with client registrant"

		# disbursements
		disbursements = Disbursement.objects.filter(meta_data__processed=True)
		filename = "InfluenceExplorer/disbursements.csv"
		disbursement_file = default_storage.open(filename, 'wb')
		writer = UnicodeWriter(disbursement_file)
		writer.writerow(disbursement_heading)
		disbursements_sheet(disbursements, writer)
		disbursement_file.close()
		print "done with disbursements"

		# contributions
		contributions = Contribution.objects.filter(meta_data__processed=True)
		filename = "InfluenceExplorer/contributions.csv"
		contribution_file = default_storage.open(filename, 'wb')
		writer = UnicodeWriter(contribution_file)
		writer.writerow(contribution_heading)
		contributions_sheet(contributions, writer)
		contribution_file.close()
		print "done with contributions"

		# payments
		payments = Payment.objects.filter(meta_data__processed=True)
		filename = "InfluenceExplorer/payments.csv"
		payment_file = default_storage.open(filename, 'wb')
		writer = UnicodeWriter(payment_file)
		writer.writerow(payment_heading)
		payments_sheet(payments, writer)
		payment_file.close()
		print "done with payments"

		print "ending", datetime.datetime.now().time()