Exemplo 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
Exemplo 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
Exemplo n.º 3
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)
Exemplo n.º 4
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
Exemplo n.º 5
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
Exemplo n.º 6
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
Exemplo n.º 7
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