Exemplo n.º 1
0
from django_bootstrap import bootstrap
bootstrap()

from appl.models import AdmissionRound


def main():
    rounds = [
        (1, 1, 1, 1, '', 'การรับด้วย Portfolio (ช่วงที่หนึ่ง)'),
        (2, 1, 2, 2, '', 'การรับด้วย Portfolio (ช่วงที่สอง)'),
        (3, 2, 0, 3, '', 'การรับระบบโควตา'),
        (4, 3, 0, 4, '', 'การรับตรงร่วมกัน'),
        (5, 4, 0, 5, '', 'การรับระบบกลาง Admissions'),
        (6, 5, 0, 6, '', 'การรับตรงอิสระ'),
    ]

    for r in AdmissionRound.objects.all():
        r.delete()

    for rraw in rounds:
        r = AdmissionRound(id=rraw[0],
                           number=rraw[1],
                           subround_number=rraw[2],
                           rank=rraw[3],
                           admission_dates=rraw[4],
                           short_descriptions=rraw[5])
        r.save()


if __name__ == '__main__':
    main()
Exemplo n.º 2
0
from django.conf import settings
from django_bootstrap import bootstrap
bootstrap(__file__)

from confirmation.models import AdmissionMajorPreference

for p in AdmissionMajorPreference.objects.all():
    p.set_ptype_cache()


Exemplo n.º 3
0
'''
Created on Jun 29, 2011

@author: jackdreilly
'''
from django_bootstrap import bootstrap
bootstrap(__file__ + '/../')
from django.contrib.sites.models import Site
from constants import *
from django.contrib.auth.models import User


site = Site.objects.get_current()
site.domain = DOMAIN
site.name = DOMAIN_NAME
site.save()
for i in range(len(ADMIN_UN)):
    User.objects.create_superuser(ADMIN_UN[i], ADMIN_UE[i], ADMIN_PW[i]).save()

Exemplo n.º 4
0
#!/usr/bin/env python
import sys
if len(sys.argv) != 3:
    print "Usage: python confirm.py [round_number] [payin.txt]"
    quit()

import os
import datetime

path = os.path.dirname(__file__)
parent_path = os.path.abspath(os.path.join(path, '..'))
sys.path.append(parent_path)

from django.conf import settings
from django_bootstrap import bootstrap
bootstrap(__file__)

from application.models import Applicant
from confirmation.models import AdmissionConfirmation
from result.models import AdmissionResult

round_number = int(sys.argv[1])
filename = sys.argv[2]

lines = open(filename).readlines()

updated_count = 0
error_count = 0

for ln in lines:
    if len(ln) != 0 and ln[0] == 'D':
Exemplo n.º 5
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django_bootstrap import bootstrap

# put the path of the faces website here
bootstrap("../../barcampboston/")

from attendees.models import Event

from make_pdf import MakePdf
import urllib
import os
import sys
import unicodedata

#####################################################################
#
# This takes all the attendees who are in the Django database and
# makes PDF namebadges for them.
#
# This also generates blank badges with individual QR code numbers
# on them.
#
#####################################################################
#
# requires Inkscape
#
# makes network calls to generate the QR code using Google's chart API
#
#####################################################################
#
Exemplo n.º 6
0
from django_bootstrap import bootstrap

bootstrap()

from urllib import request, error
import csv, os
from main.models import Product

def main():
    os.makedirs('imgs')
    Product.objects.all().delete()
    with open('./scripts/condoms.csv') as csv_file:
        csv_content = csv.reader(csv_file, delimiter=',')
        counter = 0
        for row in csv_content:
            img_url = row[3]
            img_type = img_url.split('.')[-1]
            img_dest = './media/imgs/product_img{0}.{1}'.format(counter, img_type)
            try:
                request.urlretrieve(img_url, img_dest)
            except error.HTTPError as e:
                print(counter, e)
            product = Product.objects.create(
                name=row[0],
                desc=row[1],
                price=row[2],
                amount=50,
                pic= ('/imgs/product_img{0}.{1}'.format(counter, img_type))
            )
            product.save()
            counter += 1
from django_bootstrap import bootstrap

bootstrap("ks_django")

from crawler.models import *
from datetime import datetime, date
import urllib
import re
from bs4 import BeautifulSoup

base_url = "http://www.kickstarter.com"
url = "http://www.kickstarter.com/projects/doublefine/double-fine-adventure"
url = "http://www.kickstarter.com/projects/blytherenay/damsels-of-dorkington-2012-season/backers"
#url = "http://www.kickstarter.com/projects/blytherenay/damsels-of-dorkington-2012-season/?ref=live"

bs = BeautifulSoup(urllib.urlopen(url))

waiting_urls = []

scraped_urls = []

profiles = []

if (re.search(r"/backers", url)):  #backers url. Scan for new profiles
    projurl = re.search(r"^(.+)/backers", url)
    proj = Project.objects.get(url=projurl.group(1))
    backers_added = 0
    for b in bs.body.find(id="leftcol").find_all("div",
                                                 "NS-backers-backing-row"):
        username = b.a['href'][8:]
        if not Backer.objects.filter(username=username):
Exemplo n.º 8
0
from django_bootstrap import bootstrap

bootstrap("ks_django")

from crawler.models import *
from datetime import datetime, date
import urllib
import re
from bs4 import BeautifulSoup

base_url = "http://www.kickstarter.com"
url = "http://www.kickstarter.com/projects/doublefine/double-fine-adventure"
url = "http://www.kickstarter.com/projects/blytherenay/damsels-of-dorkington-2012-season/backers"
#url = "http://www.kickstarter.com/projects/blytherenay/damsels-of-dorkington-2012-season/?ref=live"

bs = BeautifulSoup(urllib.urlopen(url))

waiting_urls = []

scraped_urls = []

profiles = []

if(re.search(r"/backers", url)): #backers url. Scan for new profiles
	projurl = re.search(r"^(.+)/backers", url)
	proj = Project.objects.get(url=projurl.group(1))
	backers_added = 0
	for b in bs.body.find(id="leftcol").find_all("div", "NS-backers-backing-row"):
		username = b.a['href'][8:]
		if not Backer.objects.filter(username = username):
			proj.backer_set.create(username = username)
Exemplo n.º 9
0
import django_bootstrap, __main__

if '__file__' in dir(__main__):
  django_bootstrap.bootstrap(__main__.__file__)
else:
  import os
  django_bootstrap.bootstrap(os.getcwd())
Exemplo n.º 10
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from django_bootstrap import bootstrap

# put the path of the faces website here
bootstrap("../../barcampboston/")

from attendees.models import Event

from make_pdf import MakePdf
import urllib
import os
import sys
import unicodedata

#####################################################################
#
# This takes all the attendees who are in the Django database and 
# makes PDF namebadges for them. 
# 
# This also generates blank badges with individual QR code numbers
# on them.
#
#####################################################################
#
# requires Inkscape
#
# makes network calls to generate the QR code using Google's chart API
#
#####################################################################
#
Exemplo n.º 11
0
from django_bootstrap import bootstrap
bootstrap(__file__ + '/../')
from django.contrib.sites.models import Site
from constants import *
from django.contrib.auth.models import User

site = Site.objects.get_current()
site.domain = DOMAIN
site.name = DOMAIN_NAME
site.save()
User.objects.create_superuser(ADMIN_UN, ADMIN_UE, ADMIN_PW).save()