Skip to content

Commit

Permalink
DF-DF-800:Added more records attributes
Browse files Browse the repository at this point in the history
  • Loading branch information
TNA-Allan committed Aug 21, 2023
1 parent 96d16a4 commit 0f33428
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 1 deletion.
7 changes: 7 additions & 0 deletions etna/records/field_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,11 @@
"record_opening": "Record opening date",
"title": "Title",
"former_department_reference": "Former reference in its original department",
"language": "Language",
"creator": "Creator",
"physical_description": "Physical description",
"immediate_source_of_acquisition": "Immediate source of acquisition",
"accruals": "Accruals",
"administrative_background": "Administrative/ biographical background",
"separated_materials": "Separated material",
}
36 changes: 35 additions & 1 deletion etna/records/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -904,11 +904,45 @@ def former_name_authority_reference(self) -> str:
@cached_property
def closure_status(self) -> str:
return extract(self.get("@template", {}), "details.closureStatus", default="")

@cached_property
def former_department_reference(self) -> str:
return self.template.get("formerDepartmentReference", "")

@cached_property
def language(self) -> list(str):
return self.template.get("language", [])

@cached_property
def creator(self) -> list(str):
return self.template.get("creator", [])

@cached_property
def physical_description(self) -> str:
return self.template.get("physicalDescription", "")

@cached_property
def immediate_source_of_acquisition(self) -> list(str):
return self.template.get("immediateSourceOfAcquisition", [])

@cached_property
def accruals(self) -> str:
return self.template.get("accruals", "")

@cached_property
def administrative_background(self) -> str:
return self.template.get("administrativeBackground", "")

@cached_property
def separated_materials(self) -> Tuple[Dict[str, Any]]:
return tuple(
dict(
description=item.get("description", ""),
links=list(format_link(val) for val in item.get("links", ())),
)
for item in self.template.get("separatedMaterials", ())
)


@dataclass
class Image:
Expand Down
65 changes: 65 additions & 0 deletions templates/includes/records/record-details.html
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,23 @@
{% endfor %}
</td>
</tr>
{% endif %}
{% if record.separated_materials %}
<tr>
<th scope="row">{{ 'separated_materials'|as_label }}</th>
<td>
{% for separated_material in record.separated_materials %}
{% if separated_material.description %}
<p>{{ separated_material.description }}</p>
{% endif %}
{% if separated_material.links %}
{% for link in separated_material.links %}
<p><a href="{{ link.href }}">{{ link.text }}</a></p>
{% endfor %}
{% endif %}
{% endfor %}
</td>
</tr>
{% endif %}
{% if record.held_by %}
<tr>
Expand All @@ -64,6 +81,42 @@
<td>{{ record.legal_status }}</td>
</tr>
{% endif %}
{% if record.language %}
<tr>
<th scope="row">{{ 'language'|as_label }}</th>
<td>
{% for item in record.language %}
<p>{{ item }}</p>
{% endfor %}
</td>
</tr>
{% endif %}
{% if record.creator %}
<tr>
<th scope="row">{{ 'creator'|as_label }}</th>
<td>
{% for item in record.creator %}
<p>{{ item }}</p>
{% endfor %}
</td>
</tr>
{% endif %}
{% if record.physical_description %}
<tr>
<th scope="row">{{ 'physical_description'|as_label }}</th>
<td>{{ record.physical_description }}</td>
</tr>
{% endif %}
{% if record.immediate_source_of_acquisition %}
<tr>
<th scope="row">{{ 'immediate_source_of_acquisition'|as_label }}</th>
<td>
{% for item in record.immediate_source_of_acquisition %}
<p>{{ item }}</p>
{% endfor %}
</td>
</tr>
{% endif %}
{% if record.closure_status %}
<tr>
<th scope="row">{{ 'closure'|as_label }}</th>
Expand All @@ -76,6 +129,18 @@
<td>{{ record.access_condition }}</td>
</tr>
{% endif %}
{% if record.accruals %}
<tr>
<th scope="row">{{ 'accruals'|as_label }}</th>
<td>{{ record.accruals }}</td>
</tr>
{% endif %}
{% if record.administrative_background %}
<tr>
<th scope="row">{{ 'administrative_background'|as_label }}</th>
<td>{{ record.administrative_background }}</td>
</tr>
{% endif %}
{% if record.record_opening %}
<tr>
<th scope="row">{{ 'record_opening'|as_label }}</th>
Expand Down

0 comments on commit 0f33428

Please sign in to comment.