Ejemplo n.º 1
0
def run():
    table = get_data(get_data_path('taxonomy.csv'))
    group_id = species_id = 1
    for index in range(1, len(table)):
        row = table[index]
        kwargs = {
            'id': group_id,
            'order': row[5],
            'family': row[6].split('(')[0].strip(),
            'genus': row[3].split(' ')[0],
        }
        if 'en' in get_languages() and '(' in row[6]:
            kwargs['name_en'] = row[6].split('(')[1][:-1].strip()
        group, created = SpeciesGroup.objects.get_or_create(**kwargs)
        if created:
            group_id += 1

        Species.objects.create(
            id=species_id,
            include=False,
            order=species_id,
            rank=Rank.objects.get(slug=row[1]),
            group=group,
            standard_name=row[4],
            scientific_name=row[3],
        )
        if created:
            species_id += 1
Ejemplo n.º 2
0
def run():
    fields = ('id', 'slug') + i18n_fieldnames('name')
    data = get_data(get_data_path('sex.csv'))
    create_objects(Sex, fields, data)
Ejemplo n.º 3
0
def run():
    fields = ('id', 'slug') + i18n_fieldnames('name')
    data = get_data(get_data_path('direction.csv'))
    create_objects(Direction, fields, data)
Ejemplo n.º 4
0
def run():
    fields = ('id', 'slug') + i18n_fieldnames('name')
    data = get_data(get_data_path('plumage.csv'))
    create_objects(Plumage, fields, data)
Ejemplo n.º 5
0
def run():
    fields = ('id', 'slug') + i18n_fieldnames('name')
    data = get_data(get_data_path('activity.csv'))
    create_objects(Activity, fields, data)
Ejemplo n.º 6
0
def run():
    fields = ('id', 'slug') + i18n_fieldnames('name')
    data = get_data(get_data_path('protocol.csv'))
    create_objects(Protocol, fields, data)