|
|
|
|
|
|
|
|
from .models import Resource |
|
|
from .models import Resource |
|
|
from .models import Relationship |
|
|
from .models import Relationship |
|
|
from . import db |
|
|
from . import db |
|
|
|
|
|
import markdown |
|
|
|
|
|
|
|
|
# function to retrieve linked resources |
|
|
# function to retrieve linked resources |
|
|
def get_relationships(primary_id): |
|
|
def get_relationships(primary_id): |
|
|
|
|
|
|
|
|
else: |
|
|
else: |
|
|
resource.__dict__['practices'].append(relationship) |
|
|
resource.__dict__['practices'].append(relationship) |
|
|
elif relationship.type == 'book': |
|
|
elif relationship.type == 'book': |
|
|
|
|
|
# render Markdown as HTML |
|
|
|
|
|
relationship.description = markdown.markdown(relationship.description) |
|
|
if 'books' not in resource.__dict__.keys(): |
|
|
if 'books' not in resource.__dict__.keys(): |
|
|
resource.__dict__['books'] = [] |
|
|
resource.__dict__['books'] = [] |
|
|
resource.__dict__['books'].append(relationship) |
|
|
resource.__dict__['books'].append(relationship) |