Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Metagenomics
metagenedb
Commits
b1d5b335
Commit
b1d5b335
authored
Apr 13, 2021
by
Kenzo-Hugo Hillion
♻
Browse files
update serializer and fix list on frontend
parent
e2ada726
Pipeline
#53600
failed with stages
in 2 minutes and 32 seconds
Changes
5
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
backend/metagenedb/apps/catalog/migrations/0029_source.py
View file @
b1d5b335
...
...
@@ -15,7 +15,7 @@ def create_sources(apps, schema_editor):
{
'name'
:
'IGC-9.9M'
,
'url'
:
'https://db.cngb.org/microbiome/genecatalog/genecatalog_human/'
,
'doi'
:
'10.1038/
s41467-020-14677-3
'
'doi'
:
'10.1038/
nbt.2942
'
},
]
for
item
in
items_to_create
:
...
...
backend/metagenedb/apps/catalog/serializers/gene.py
View file @
b1d5b335
...
...
@@ -3,11 +3,12 @@ import traceback
from
rest_framework
import
serializers
from
rest_framework.utils
import
model_meta
from
metagenedb.apps.catalog.models
import
Function
,
Gene
,
GeneFunction
,
Taxonomy
from
metagenedb.apps.catalog.models
import
Function
,
Gene
,
GeneFunction
,
Source
,
Taxonomy
from
.asymetricslugrelatedfield
import
AsymetricSlugRelatedField
from
.bulk_list
import
BulkListSerializer
from
.function
import
FunctionSerializer
from
.source
import
SourceSerializer
from
.taxonomy
import
SimpleTaxonomySerializer
...
...
@@ -65,6 +66,12 @@ class GeneSerializer(serializers.ModelSerializer):
slug_field
=
'tax_id'
,
required
=
False
,
)
source
=
AsymetricSlugRelatedField
.
from_serializer
(
SourceSerializer
,
queryset
=
Source
.
objects
.
all
(),
slug_field
=
'name'
,
required
=
False
,
)
class
Meta
:
model
=
Gene
...
...
backend/metagenedb/apps/catalog/serializers/source.py
0 → 100644
View file @
b1d5b335
from
rest_framework
import
serializers
from
metagenedb.apps.catalog.models
import
Source
class
SourceSerializer
(
serializers
.
ModelSerializer
):
class
Meta
:
model
=
Source
fields
=
(
'name'
,
'url'
,
'doi'
)
frontend/src/views/genes/genes.html
View file @
b1d5b335
...
...
@@ -337,7 +337,14 @@
</v-btn>
</template>
</td>
<td
class=
"text-xs"
>
{{ props.item.source }}
</td>
<td
class=
"text-xs"
>
{{ props.item.source }}
<v-btn
:href=
"props.item.source_url"
icon
flat
small
target=
"_blank"
class=
"secondary--text mt-1 ml-0"
v-if=
"props.item.source"
>
<v-icon
small
>
open_in_new
</v-icon>
</v-btn>
</td>
</template>
</v-data-table>
</v-list>
...
...
frontend/src/views/genes/genes.js
View file @
b1d5b335
...
...
@@ -233,6 +233,10 @@ export default {
item
.
tax_url
=
ncbiTaxUrl
+
item
.
taxonomy
.
tax_id
;
item
.
taxonomy
=
`
${
item
.
taxonomy
.
name
}
(
${
item
.
taxonomy
.
rank
}
)`
;
}
if
(
item
.
source
)
{
item
.
source_url
=
item
.
source
.
url
;
item
.
source
=
item
.
source
.
name
;
}
if
(
item
.
functions
)
{
const
{
functions
}
=
item
;
item
.
keggs
=
[];
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment