Some pending fixes
This commit is contained in:
parent
edb860fa16
commit
202b6c0092
2 changed files with 12 additions and 6 deletions
|
@ -356,7 +356,7 @@ class Command(BaseCommand):
|
|||
for k, v in self.csv_files_models_dict.items():
|
||||
if v.strip().lower() == model_name.strip().lower():
|
||||
csv_file_name = k
|
||||
if k == '':
|
||||
if csv_file_name == '':
|
||||
raise Exception('Could not find a csv file name for model %s' % model_name)
|
||||
if csv_folder_path.endswith('/'):
|
||||
file_path = '%s%s' % (csv_folder_path, csv_file_name)
|
||||
|
|
16
app/views.py
16
app/views.py
|
@ -176,11 +176,17 @@ def get_paginated(query_set, page, per_page):
|
|||
for p in paginator.object_list:
|
||||
filters['country'].append(p.country.short_name)
|
||||
for r in p.peoplerange_set.all():
|
||||
filters['range'].append(r.range.range_name)
|
||||
if r.range and r.range.range_name:
|
||||
filters['range'].append(r.range.range_name)
|
||||
else:
|
||||
print("r.range.range_name is None %s %s" % (r.range_id, r.person_id))
|
||||
for r in p.fieldspeople_set.all():
|
||||
filters['field'].append(r.field.name)
|
||||
for r in p.taxapeople_set.all():
|
||||
filters['taxon'].append(r.taxon.name)
|
||||
if r and r.taxon and r.taxon.name:
|
||||
filters['taxon'].append(r.taxon.name)
|
||||
else:
|
||||
print("r.taxon.name is None %s %s" % (r.range_id, r.taxon))
|
||||
filters = {
|
||||
'country': sorted(set(filters['country'])),
|
||||
'range': sorted(set(filters['range'])),
|
||||
|
@ -219,7 +225,7 @@ class SearchView(View):
|
|||
if len(q_country) > 2:
|
||||
query_set = query_set.filter(country__short_name__icontains=q_country.strip().lower())
|
||||
if len(q_range) > 2:
|
||||
ranges_people = PeopleRange.objects.filter(range__name__icontains=q_range.strip().lower())
|
||||
ranges_people = PeopleRange.objects.filter(range__range_name__icontains=q_range.strip().lower())
|
||||
r_people_ids = [rp.person_id for rp in ranges_people]
|
||||
query_set = query_set.filter(id__in=r_people_ids)
|
||||
if len(q_field) > 2:
|
||||
|
@ -239,8 +245,8 @@ class PeopleDetailView(View):
|
|||
person = get_object_or_404(Person, id=people_id)
|
||||
return_data = {
|
||||
'data': person.dict(),
|
||||
'resources': [r.resource.dict() for r in person.resourcespeople_set.all()],
|
||||
'ranges': [r.range.dict() for r in person.rangespeople_set.all()],
|
||||
'resources': [r.resource.dict() for r in person.peopleresource_set.all()],
|
||||
'ranges': [r.range.dict() for r in person.peoplerange_set.all()],
|
||||
'fields': [r.field.name for r in person.fieldspeople_set.all()],
|
||||
'methods': [r.method.name for r in person.methodspeople_set.all()],
|
||||
'scales': [r.scale.name for r in person.scalespeople_set.all()],
|
||||
|
|
Loading…
Reference in a new issue