Example #1
0
def on_models_committed(sender, changes):
    data = []
    for model, change in changes:
        if isinstance(model, INDEXABLE):
            data.append([change, model.search_mapping()])
    if data:
        try:
            update_index.delay(data)
        except RuntimeError:
            with app.test_request_context():
                update_index.delay(data)
Example #2
0
def on_models_committed(sender, changes):
    data = []
    for model, change in changes:
        if isinstance(model, INDEXABLE):
            data.append([change, model.search_mapping()])
    if data:
        try:
            update_index.delay(data)
        except RuntimeError:
            with app.test_request_context():
                update_index.delay(data)
Example #3
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from hasjob import app, init_for, models
from hasjob.models import db

if __name__ == '__main__':

    import sys
    init_for('dev')
    # Seed with sample data
    with app.test_request_context():
        if models.JobType.query.count() == 0:
            print >> sys.stderr, "Adding some job types"
            db.session.add(
                models.JobType(seq=10,
                               name=u'fulltime',
                               title=u'Full-time employment'))
            db.session.add(
                models.JobType(seq=20,
                               name=u'contract',
                               title=u'Short-term contract'))
            db.session.add(
                models.JobType(seq=30,
                               name=u'freelance',
                               title=u'Freelance or consulting'))
            db.session.add(
                models.JobType(seq=40,
                               name=u'volunteer',
                               title=u'Volunteer contributor'))
            db.session.add(
                models.JobType(seq=50,
Example #4
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from hasjob import app, init_for, models
from hasjob.models import db
from hasjob.search import configure as search_configure
from hasjob.uploads import configure as uploads_configure

if __name__ == '__main__':

    import sys
    init_for('dev')
    # Seed with sample data
    with app.test_request_context():
        if models.JobType.query.count() == 0:
            print >> sys.stderr, "Adding some job types"
            db.session.add(models.JobType(seq=10, name=u'fulltime', title=u'Full-time employment'))
            db.session.add(models.JobType(seq=20, name=u'contract', title=u'Short-term contract'))
            db.session.add(models.JobType(seq=30, name=u'freelance', title=u'Freelance or consulting'))
            db.session.add(models.JobType(seq=40, name=u'volunteer', title=u'Volunteer contributor'))
            db.session.add(models.JobType(seq=50, name=u'partner', title=u'Partner for a venture'))
            db.session.commit()
        if models.JobCategory.query.count() == 0:
            print >> sys.stderr, "Adding some job categories"
            db.session.add(models.JobCategory(seq=10, name=u'programming', title=u'Programming'))
            db.session.add(models.JobCategory(seq=20, name=u'ux', title=u'Interaction Design'))
            db.session.add(models.JobCategory(seq=30, name=u'design', title=u'Graphic Design'))
            db.session.add(models.JobCategory(seq=40, name=u'testing', title=u'Testing'))
            db.session.add(models.JobCategory(seq=50, name=u'sysadmin', title=u'Systems Administration'))
            db.session.add(models.JobCategory(seq=60, name=u'business', title=u'Business/Management'))
            db.session.add(models.JobCategory(seq=70, name=u'edit', title=u'Writer/Editor'))
            db.session.add(models.JobCategory(seq=80, name=u'support', title=u'Customer Support'))