Skip to content

Commit

Permalink
Add support for concept complex handler
Browse files Browse the repository at this point in the history
  • Loading branch information
bmamlin committed Nov 22, 2021
1 parent a6947b9 commit bb75692
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 5 additions & 0 deletions omrs/management/commands/extract_db.py
Expand Up @@ -466,6 +466,11 @@ def export_concept(self, concept):
add_f(extras_dict, 'display_precision',
numeric_metadata.display_precision)
extras.update(extras_dict)

# If the concept is complex, map hander as extra
if hasattr(concept, 'complex_handler'):
add_f(extras, 'handler', concept.complex_handler.handler)

data['extras'] = extras

return data
Expand Down
3 changes: 2 additions & 1 deletion omrs/models.py
Expand Up @@ -88,7 +88,8 @@ class Meta:


class ConceptComplex(models.Model):
concept = models.ForeignKey(Concept, primary_key=True)
concept = models.OneToOneField(Concept, primary_key=True,
related_name='complex_handler')
handler = models.CharField(max_length=255, blank=True)

def __unicode__(self):
Expand Down

1 comment on commit bb75692

@paynejd
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

Please sign in to comment.