예제 #1
0
from public_records_portal import prr, db_helpers, departments
from public_records_portal.prflask import app
import os, random, string, json

print "Seeding database..."

# Set directory fields from information in the directory.json file
prr.set_directory_fields()

# Update user info with information in the departments.json file
departments.populate_users_with_departments()

# Create doc types based on information in the departments.json file
departments.create_doctypes()

common_requests = ['City Council meeting minutes', 'Police Report', 'Incident Report', 'Communication between Councilmembers']
depts_json = open(os.path.join(app.root_path, 'static/json/list_of_departments.json'))
staff_json = open(os.path.join(app.root_path, 'static/json/staff_emails.json'))
departments = json.load(depts_json)
people = json.load(staff_json)
reasons = ['They have the document', 'They would know more about this', 'They are my backup', 'Can you look into this?']
documents = ['Minutes', 'Report']
answers = ["Yep, thanks so much!", "No, nevermind then."]

# Create some seed data so our tests run
for i in range(20):
	request_type = random.choice(common_requests)
	request_department = random.choice(departments)
	random_number = random.randrange(0, 901, 4)
	another_random_number =  random.randrange(0, 901, 4)
	request_text = "%(request_type)s %(random_number)s" % locals()
예제 #2
0
from public_records_portal.notifications import notify_due
from public_records_portal.departments import populate_users_with_departments
from public_records_portal.prr import set_directory_fields

# Notify city staff via e-mail if they belong to a request that is due soon or overdue:
notify_due()

# Set directory fields from information in the directory.json file
set_directory_fields()

# Update user info with information in the departments.json file
populate_users_with_departments()

예제 #3
0
from public_records_portal import prr, db_helpers, departments
from public_records_portal.prflask import app
import os, random, string, json

print "Seeding database..."

# Set directory fields from information in the directory.json file
prr.set_directory_fields()

# Update user info with information in the departments.json file
departments.populate_users_with_departments()

# Create doc types based on information in the departments.json file
departments.create_doctypes()

common_requests = [
    'City Council meeting minutes', 'Police Report', 'Incident Report',
    'Communication between Councilmembers'
]
depts_json = open(
    os.path.join(app.root_path, 'static/json/list_of_departments.json'))
staff_json = open(os.path.join(app.root_path, 'static/json/staff_emails.json'))
departments = json.load(depts_json)
people = json.load(staff_json)
reasons = [
    'They have the document', 'They would know more about this',
    'They are my backup', 'Can you look into this?'
]
documents = ['Minutes', 'Report']
answers = ["Yep, thanks so much!", "No, nevermind then."]
예제 #4
0
from public_records_portal.prr import set_directory_fields

# Set directory fields from CSV data supplied (via STAFF_URL and LIAISONS_URL)
set_directory_fields()