Skip to content
Discussion options

You must be logged in to vote

content_type_id refers to an entry in table django_content_type; from that you can get the model and hence the table. object_id is the 'id' within the table in question.

So, to get tags associated with device type would be something like this:

select dt.id,dt.model,ti.tag_id
from dcim_devicetype dt
left join extras_taggeditem ti on ti.object_id=dt.id and ti.content_type_id=(
    select id from django_content_type where app_label='dcim' and model='devicetype');

... with a further join on extras_tag if you want to map the tag_id to the tag name.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@filipeandrade6
Comment options

Answer selected by filipeandrade6
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants