diff --git a/bag_transfer/rights/models.py b/bag_transfer/rights/models.py
index 9c2f8862..feb2dfc2 100644
--- a/bag_transfer/rights/models.py
+++ b/bag_transfer/rights/models.py
@@ -40,6 +40,20 @@ class RightsStatement(models.Model):
def __str__(self):
return "{}: {}".format(self.organization, self.rights_basis)
+ @property
+ def dates_applicable_display(self):
+ """Returns a display string of applicable dates for a rights statement.
+
+ Assumes that start and end dates exist on the rights statement,
+ in other words, assumes it is a rights statement that has been assigned
+ to a transfer.
+ """
+ date_keys = self.get_date_keys(periods=True)
+ rights_object = self.rights_info
+ start_date = getattr(rights_object, date_keys[0])
+ end_date = getattr(rights_object, date_keys[2]) if len(date_keys) > 2 else getattr(rights_object, date_keys[1])
+ return f"{start_date.strftime('%b %d %Y') if start_date else 'immediately'} - {end_date.strftime('%b %d %Y') if end_date else 'no end date'}"
+
@property
def rights_info(self):
"""Returns the rights info object associated with a Rights Statement."""
diff --git a/bag_transfer/templates/parts/rights_table.html b/bag_transfer/templates/parts/rights_table.html
index bf241989..91f2e65f 100644
--- a/bag_transfer/templates/parts/rights_table.html
+++ b/bag_transfer/templates/parts/rights_table.html
@@ -11,7 +11,7 @@
{% for statement in org.rights_statements %}
- {% for t in statement.applies_to_type.all %}{{t.name}}{% if not forloop.last %} {%endif%}{% endfor %} |
+ {% for t in statement.applies_to_type.all %}- {{t.name}}
{% endfor %} |
{{statement.rights_basis}} |
{{statement.rights_info_notes}} |
diff --git a/bag_transfer/templates/parts/transfer_rights_table.html b/bag_transfer/templates/parts/transfer_rights_table.html
index 44b64db0..6190a4ee 100644
--- a/bag_transfer/templates/parts/transfer_rights_table.html
+++ b/bag_transfer/templates/parts/transfer_rights_table.html
@@ -4,6 +4,7 @@
|
Basis |
Rights Notes |
+ Dates Applicable |
@@ -11,6 +12,7 @@
{{statement.rights_basis}} |
{{statement.rights_info_notes}} |
+ {{statement.dates_applicable_display}} |
{% endfor %}
diff --git a/bag_transfer/templates/transfers/detail.html b/bag_transfer/templates/transfers/detail.html
index d9dd4a95..c282eaaf 100644
--- a/bag_transfer/templates/transfers/detail.html
+++ b/bag_transfer/templates/transfers/detail.html
@@ -64,6 +64,21 @@ Error Messages
{% endif %}
+{% if object.rights_statements.all %}
+
+
+
+
+
+ {% include 'parts/transfer_rights_table.html' with rights_statements=object.rights_statements.all %}
+
+
+
+
+{% endif %}
+
-{% if object.rights_statements.all %}
-
-
-
-
-
- {% include 'parts/transfer_rights_table.html' with rights_statements=object.rights_statements.all %}
-
-
-
-
-{% endif %}
-
{% if object.archivesspace_identifier or object.archivesspace_parent_identifier %}
diff --git a/scripts/import_sample_data b/scripts/import_sample_data
index 8e202408..e90fc68c 100755
--- a/scripts/import_sample_data
+++ b/scripts/import_sample_data
@@ -3,6 +3,6 @@
# Script to import set of sample bags
# Copies files to data upload directory and then runs cron
-cp -r ../sample_bags/* /data/donororganization/upload/
+cp -r sample_bags/* /data/donororganization/upload/
chown -R donor /data/donororganization/upload/
python manage.py runcrons bag_transfer.lib.cron.DiscoverTransfers