Skip to content

Commit

Permalink
rename project_id attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
atarkowska committed Nov 10, 2017
1 parent f44374e commit 9c390ed
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions emgapi/serializers.py
Original file line number Diff line number Diff line change
Expand Up @@ -689,6 +689,11 @@ class StudySerializer(ExplicitFieldsModelSerializer,
lookup_field='accession',
)

bioproject = serializers.SerializerMethodField()

def get_bioproject(self, obj):
return obj.project_id

# relationships
biomes = emg_relations.HyperlinkedSerializerMethodResourceRelatedField(
many=True,
Expand Down Expand Up @@ -741,6 +746,7 @@ class Meta:
exclude = (
# TODO: remove biome when schema updated
'biome',
'project_id',
'is_public',
'experimental_factor',
'submission_account_id',
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def test_list(self, live_server, runs, api_version):
for run in run_list:
print(
study.accession,
study.project_id,
study.bioproject,
sample.accession,
sample.biome.biome_name,
sample.runs_count,
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_study.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_details(self, client, study):
assert _attr['study-name'] == "Example study name SRP01234"
assert _attr['data-origination'] == "HARVESTED"
assert _attr['last-update'] == "1970-01-01T00:00:00"
assert _attr['project-id'] == "PRJDB1234"
assert _attr['bioproject'] == "PRJDB1234"

def test_public(self, client, study, study_private):
url = reverse("emgapi:studies-list")
Expand Down

0 comments on commit 9c390ed

Please sign in to comment.