Ejemplo n.º 1
0
def _create_testbed():
    image_name = images.random_image(u'%s.png' % slugify(text.random_words(1)))
    data = {
        'name': text.random_words(3).title(),
        'summary': text.random_words(10),
        'description': text.random_paragraphs(2),
        'contact': choice([None, _get_user()]),
        'organization': choice([None, _get_organization()]),
        'website': _get_url(),
        'image': image_name,
        'network_speed': NetworkSpeed.objects.all().order_by('?')[0],
        'connections': text.random_paragraphs(1),
        'experimentation': choice(Testbed.EXPERIMENTATION_CHOICES)[0],
        'passes_homes': randint(0, 100),
        'passes_business': randint(0, 100),
        'passes_anchor': randint(0, 100),
        'is_advanced': choice([True, False]),
        'position': locations.get_location(),
        'status': choice(Testbed.STATUS_CHOICES)[0],
    }
    testbed = Testbed.objects.create(**data)
    _add_tags(testbed)
    _add_features(testbed)
    _add_applications(testbed)
    return testbed
Ejemplo n.º 2
0
def _create_hub():
    image_name = images.random_image(u'%s.png' % text.random_words(1))
    data = {
        'name': text.random_words(3).title(),
        'contact': choice([None, _get_user()]),
        'summary': text.random_words(10),
        'connections': text.random_paragraphs(1),
        'organization': choice([None, _get_organization()]),
        'network_speed': NetworkSpeed.objects.all().order_by('?')[0],
        'is_advanced': choice([True, False]),
        'experimentation': choice(Hub.EXPERIMENTATION_CHOICES)[0],
        'estimated_passes': text.random_words(10),
        'description': text.random_paragraphs(3),
        'image': image_name,
        'website': _get_url(),
        'status': choice(Hub.STATUS_CHOICES)[0],
        'is_featured': choice([True, False]),
        'position': locations.get_location(),
    }
    hub = Hub.objects.create(**data)
    _create_hub_membership(hub)
    _add_tags(hub)
    _add_features(hub)
    _add_applications(hub)
    return hub
Ejemplo n.º 3
0
def _create_location_category():
    name = text.random_words(2).title()
    data = {
        'name': name,
        'slug': slugify(name),
    }
    return Category.objects.create(**data)
Ejemplo n.º 4
0
def _create_article():
    data = {
        'name': text.random_words(7).title(),
        'status': choice(Article.STATUS_CHOICES)[0],
        'url': _get_url(),
        'is_featured': choice([True, False]),
    }
    return Article.objects.create(**data)
Ejemplo n.º 5
0
def _create_question(challenge, order=0):
    data = {
        'challenge': challenge,
        'question': u'%s?' % text.random_words(7),
        'is_required': choice([True, False]),
        'order': order,
    }
    return Question.objects.create(**data)
Ejemplo n.º 6
0
def _create_location():
    data = {
        'name': text.random_words(4).title(),
        'website': _get_url(),
        'status': choice(Location.STATUS_CHOICES)[0],
        'position': locations.get_location(),
        'category': _get_location_category(),
    }
    return Location.objects.create(**data)
Ejemplo n.º 7
0
def _create_hub():
    image_name = images.random_image(u'%s.png' % text.random_words(1))
    data = {
        'name': text.random_words(3).title(),
        'summary': text.random_words(10),
        'description': text.random_paragraphs(3),
        'contact': choice([None, _get_user()]),
        'image': image_name,
        'website': _get_url(),
        'status': choice(Hub.STATUS_CHOICES)[0],
        'is_featured': choice([True, False]),
        'position': locations.get_location(),
    }
    hub = Hub.objects.create(**data)
    _create_hub_membership(hub)
    _add_tags(hub)
    _add_features(hub)
    return hub
Ejemplo n.º 8
0
def _create_organization():
    name = text.random_words(3)
    image_name = u'%s.png' % slugify(text.random_words(1))
    data = {
        'name': name.title(),
        'slug': slugify(name),
        'status': choice(Organization.STATUS_CHOICES)[0],
        'bio': _choice(text.random_words(30)),
        'image': images.random_image(image_name),
        'position': locations.get_location(),
        'interest_ignite': _choice(text.random_paragraphs(1)),
        'interests_other': _choice(text.random_words(5)),
        'resources_available': _choice(text.random_paragraphs(1)),
    }
    organization = Organization.objects.create(**data)
    _add_tags(organization)
    _create_organization_membership(organization)
    return organization
Ejemplo n.º 9
0
def _create_resource():
    name = text.random_words(4)
    data = {
        'name': name.title(),
        'slug': slugify(name),
        'status': choice(Resource.STATUS_CHOICES)[0],
        'description': text.random_paragraphs(1),
        'contact': _get_user(),
        'author': _choice(text.random_words(10)),
        'resource_date': choice([_get_start_date(), None]),
        'url': _get_url(),
        'is_featured': choice([True, False]),
        'image': images.random_image(u'%s.png' % text.random_words(1)),
        'resource_type': _get_resource_type(),
        'sector': _get_sector(),
    }
    resource = Resource.objects.create(**data)
    _add_tags(resource)
    return resource
Ejemplo n.º 10
0
def _create_page():
    data = {
        'name': text.random_words(3).title(),
        'status': choice(Application.STATUS_CHOICES)[0],
        'description': text.random_paragraphs(2),
    }
    page = Page.objects.create(**data)
    app_list = (Application.objects
                .filter(status=Application.PUBLISHED).order_by('?')[:10])
    for i, app in enumerate(app_list):
        PageApplication.objects.create(page=page, application=app, order=i)
Ejemplo n.º 11
0
def _create_event():
    start_date = _get_start_date()
    end_date = start_date + timedelta(hours=5)
    data = {
        'name': text.random_words(5),
        'status': choice(Event.STATUS_CHOICES)[0],
        'image': images.random_image(u'%s.png' % text.random_words(1)),
        'start_datetime': start_date,
        'end_datetime': choice([None, end_date]),
        'address': text.random_words(7),
        'description': text.random_paragraphs(2),
        'is_featured': choice([True, False]),
        'user': _get_user(),
        'position': locations.get_location(),
    }
    event = Event.objects.create(**data)
    _add_tags(event)
    for i in range(0, 3):
        event.hubs.add(_get_hub())
    return event
Ejemplo n.º 12
0
def _create_challenge():
    start_date = _get_start_date()
    end_date = start_date + timedelta(days=15)
    data = {
        'name': text.random_words(5).title(),
        'status': choice(Challenge.STATUS_CHOICES)[0],
        'start_datetime': start_date,
        'end_datetime': end_date,
        'url': _get_url(),
        'is_external': choice([True, False]),
        'summary': text.random_paragraphs(1),
        'description': text.random_paragraphs(3),
        'image': images.random_image(u'%s.png' % text.random_words(1)),
        'user': _get_user(),
    }
    challenge = Challenge.objects.create(**data)
    for i in range(0, 10):
        _create_question(challenge, i)
    _create_entries(challenge)
    return challenge
Ejemplo n.º 13
0
def _create_entries(challenge):
    apps = list(Application.objects.all().order_by('?'))
    entry_list = []
    for i in range(0, choice(range(1, 10))):
        data = {
            'challenge': challenge,
            'application': apps.pop(),
            'status': choice(Entry.STATUS_CHOICES)[0],
            'notes': _choice(text.random_words(10)),
        }
        entry = Entry.objects.create(**data)
        entry_list.append(entry)
    return entry_list
Ejemplo n.º 14
0
def _create_app():
    image_name = images.random_image(u'%s.png' % text.random_words(1))
    data = {
        'name': text.random_words(3).title(),
        'stage': choice(Application.STAGE_CHOICES)[0],
        'status': choice(Application.STATUS_CHOICES)[0],
        'website': _get_url(),
        'summary': _choice(text.random_words(20))[:140],
        'impact_statement': text.random_words(20)[:140],
        'assistance': _choice(text.random_words(30)),
        'team_name': _choice(text.random_words(5)),
        'team_description': _choice(text.random_words(30)),
        'acknowledgments': _choice(text.random_words(30)),
        'domain': _get_domain(),
        'is_featured': choice([True, False]),
        'owner': _get_user(),
        'image': image_name,
    }
    application = Application.objects.create(**data)
    _add_tags(application)
    return application
Ejemplo n.º 15
0
def _create_users():
    users = ['banana', 'apple', 'orange', 'cherry', 'lemon', 'grape']
    profile_list = []
    for f in users:
        email =  '*****@*****.**' % f
        user, is_new = User.objects.get_or_create(
            username=f, is_active=True, email=email)
        if is_new and choice([True, False]):
            data = {
                'quote': text.random_words(9)[:140],
                'bio': text.random_paragraphs(2),
                'position': locations.get_location(),
                'user': user,
                'name': f,
                'availability': choice(Profile.AVAILABILITY_CHOICES)[0],
            }
            profile = Profile.objects.create(**data)
            _add_tags(profile)
            profile_list.append(profile)
    return profile_list
Ejemplo n.º 16
0
def _get_tags(total=5):
    tags = ['gigabit', 'healthcare', 'education', 'energy']
    tags += [slugify(w) for w in text.random_words(total).split()]
    shuffle(tags)
    return tags[:total]
Ejemplo n.º 17
0
def _create_blog_link():
    data = {
        'name': text.random_words(6).title(),
        'url': _get_url(),
    }
    return BlogLink.objects.create(**data)