mirror of
https://github.com/Southampton-RSG/breccia-mapper.git
synced 2026-03-03 03:17:07 +00:00
feat: add export views for organisation types
This commit is contained in:
@@ -87,3 +87,55 @@ class RelationshipAnswerSetSerializer(AnswerSetSerializer):
|
|||||||
'timestamp',
|
'timestamp',
|
||||||
'replaced_timestamp',
|
'replaced_timestamp',
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationSerializer(base.FlattenedModelSerializer):
|
||||||
|
class Meta:
|
||||||
|
model = models.Organisation
|
||||||
|
fields = [
|
||||||
|
'id',
|
||||||
|
'name',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationAnswerSetSerializer(AnswerSetSerializer):
|
||||||
|
question_model = models.OrganisationQuestion
|
||||||
|
organisation = OrganisationSerializer()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.OrganisationAnswerSet
|
||||||
|
fields = [
|
||||||
|
'id',
|
||||||
|
'organisation',
|
||||||
|
'timestamp',
|
||||||
|
'replaced_timestamp',
|
||||||
|
'latitude',
|
||||||
|
'longitude',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationRelationshipSerializer(base.FlattenedModelSerializer):
|
||||||
|
source = OrganisationSerializer()
|
||||||
|
target = OrganisationSerializer()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.OrganisationRelationship
|
||||||
|
fields = [
|
||||||
|
'id',
|
||||||
|
'source',
|
||||||
|
'target',
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationRelationshipAnswerSetSerializer(AnswerSetSerializer):
|
||||||
|
question_model = models.OrganisationRelationshipQuestion
|
||||||
|
relationship = OrganisationRelationshipSerializer()
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
model = models.OrganisationRelationshipAnswerSet
|
||||||
|
fields = [
|
||||||
|
'id',
|
||||||
|
'relationship',
|
||||||
|
'timestamp',
|
||||||
|
'replaced_timestamp',
|
||||||
|
]
|
||||||
|
|||||||
@@ -57,6 +57,42 @@
|
|||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Organisation</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-info"
|
||||||
|
href="{% url 'export:organisation' %}">Export</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Organisation Answer Sets</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-info"
|
||||||
|
href="{% url 'export:organisation-answer-set' %}">Export</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Organisation Relationships</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-info"
|
||||||
|
href="{% url 'export:organisation-relationship' %}">Export</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
|
<tr>
|
||||||
|
<td>Organisation Relationship Answer Sets</td>
|
||||||
|
<td></td>
|
||||||
|
<td>
|
||||||
|
<a class="btn btn-info"
|
||||||
|
href="{% url 'export:organisation-relationship-answer-set' %}">Export</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
|
||||||
<tr>
|
<tr>
|
||||||
<td>Activities</td>
|
<td>Activities</td>
|
||||||
<td></td>
|
<td></td>
|
||||||
|
|||||||
@@ -26,6 +26,22 @@ urlpatterns = [
|
|||||||
views.people.RelationshipAnswerSetExportView.as_view(),
|
views.people.RelationshipAnswerSetExportView.as_view(),
|
||||||
name='relationship-answer-set'),
|
name='relationship-answer-set'),
|
||||||
|
|
||||||
|
path('export/organisation',
|
||||||
|
views.people.OrganisationExportView.as_view(),
|
||||||
|
name='organisation'),
|
||||||
|
|
||||||
|
path('export/organisation-answer-sets',
|
||||||
|
views.people.OrganisationAnswerSetExportView.as_view(),
|
||||||
|
name='organisation-answer-set'),
|
||||||
|
|
||||||
|
path('export/organisation-relationships',
|
||||||
|
views.people.OrganisationRelationshipExportView.as_view(),
|
||||||
|
name='organisation-relationship'),
|
||||||
|
|
||||||
|
path('export/organisation-relationship-answer-sets',
|
||||||
|
views.people.OrganisationRelationshipAnswerSetExportView.as_view(),
|
||||||
|
name='organisation-relationship-answer-set'),
|
||||||
|
|
||||||
path('export/activities',
|
path('export/activities',
|
||||||
views.activities.ActivityExportView.as_view(),
|
views.activities.ActivityExportView.as_view(),
|
||||||
name='activity'),
|
name='activity'),
|
||||||
|
|||||||
@@ -22,3 +22,23 @@ class RelationshipExportView(base.CsvExportView):
|
|||||||
class RelationshipAnswerSetExportView(base.CsvExportView):
|
class RelationshipAnswerSetExportView(base.CsvExportView):
|
||||||
model = models.relationship.RelationshipAnswerSet
|
model = models.relationship.RelationshipAnswerSet
|
||||||
serializer_class = serializers.people.RelationshipAnswerSetSerializer
|
serializer_class = serializers.people.RelationshipAnswerSetSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationExportView(base.CsvExportView):
|
||||||
|
model = models.person.Organisation
|
||||||
|
serializer_class = serializers.people.OrganisationSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationAnswerSetExportView(base.CsvExportView):
|
||||||
|
model = models.organisation.OrganisationAnswerSet
|
||||||
|
serializer_class = serializers.people.OrganisationAnswerSetSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationRelationshipExportView(base.CsvExportView):
|
||||||
|
model = models.relationship.OrganisationRelationship
|
||||||
|
serializer_class = serializers.people.OrganisationRelationshipSerializer
|
||||||
|
|
||||||
|
|
||||||
|
class OrganisationRelationshipAnswerSetExportView(base.CsvExportView):
|
||||||
|
model = models.relationship.OrganisationRelationshipAnswerSet
|
||||||
|
serializer_class = serializers.people.OrganisationRelationshipAnswerSetSerializer
|
||||||
|
|||||||
Reference in New Issue
Block a user