Skip to content

Commit

Permalink
Change global search fields in IP views
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikek committed Nov 6, 2024
1 parent 09e573a commit bae7928
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 6 deletions.
2 changes: 1 addition & 1 deletion ESSArch_Core/frontend/static/frontend/lang/en/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ const general = ($translateProvider) => {
GLOBALSEARCH: 'search ...',
GLOBALSEARCHDESC_ARCHIVE_CREATORS: 'List all authority records associated to the search term',
GLOBALSEARCHDESC_ARCHIVES: 'List all resources associated to the search term',
GLOBALSEARCHDESC_IP: "List all IP's associated to the search term",
GLOBALSEARCHDESC_IP: "List all IP's thar starts with search term in fields Label or ID",
GLOBALSEARCHDESC_MEDIUM_CONTENT: 'List all medium content associated to the search term',
GLOBALSEARCHDESC_MEDIUM: 'List all storage mediums associated to the search term',
GLOBALSEARCHDESC_MIGRATION: 'List all migrations associated to the search term',
Expand Down
2 changes: 1 addition & 1 deletion ESSArch_Core/frontend/static/frontend/lang/sv/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ export default ($translateProvider: ng.translate.ITranslateProvider) => {
GLOBALSEARCH: 'sök ...',
GLOBALSEARCHDESC_ARCHIVE_CREATORS: 'Lista alla arkivbildare som associeras med söktermen',
GLOBALSEARCHDESC_ARCHIVES: 'Lista alla arkiv som associeras med söktermen',
GLOBALSEARCHDESC_IP: 'Lista alla IPn som associeras med söktermen',
GLOBALSEARCHDESC_IP: 'Lista alla IPn som börjar med sökord i fälten Etikett eller ID',
GLOBALSEARCHDESC_MEDIUM_CONTENT: 'Lista allt innehåll i lagringsmedium som associeras med söktermen',
GLOBALSEARCHDESC_MEDIUM: 'Lista alla lagringsmedium som associeras med söktermen',
GLOBALSEARCHDESC_MIGRATION: 'Lista alla migreringar som associeras med söktermen',
Expand Down
1 change: 1 addition & 0 deletions ESSArch_Core/ip/filters.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ class InformationPackageFilter(filters.FilterSet):
field_name='submission_agreement__policy',
distinct=False
)
label = filters.CharFilter(field_name='label', lookup_expr='istartswith')

def exclude_package_type_name(self, queryset, name, value):
for package_type_id, package_type_name in InformationPackage.PACKAGE_TYPE_CHOICES:
Expand Down
3 changes: 1 addition & 2 deletions ESSArch_Core/ip/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,8 +423,7 @@ class InformationPackageViewSet(viewsets.ModelViewSet):
'id', 'object_identifier_value', 'start_date', 'end_date',
)
search_fields = (
'=id', 'object_identifier_value', 'label',
'aic__object_identifier_value', 'aic__label',
'^object_identifier_value', '^label',
)
filterset_class = InformationPackageFilter

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Generated by Django 5.0.9 on 2024-11-01 09:01

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('storage', '0046_alter_accessqueue_id_alter_ioqueue_id_alter_robot_id_and_more'),
]

operations = [
migrations.AlterUniqueTogether(
name='tapeslot',
unique_together={('slot_id', 'robot')},
),
migrations.AlterField(
model_name='tapeslot',
name='medium_id',
field=models.CharField(blank=True, max_length=255, null=True, verbose_name='The id for the medium, e.g. barcode'),
),
migrations.AlterUniqueTogether(
name='tapeslot',
unique_together={('medium_id', 'robot'), ('slot_id', 'robot')},
),
]
3 changes: 1 addition & 2 deletions ESSArch_Core/storage/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -1109,7 +1109,6 @@ class TapeSlot(models.Model):
medium_id = models.CharField(
"The id for the medium, e.g. barcode",
max_length=255,
unique=True,
blank=True,
null=True,
)
Expand Down Expand Up @@ -1147,7 +1146,7 @@ def create_from_remote_copy(cls, host, session, object_id, create_storage_medium

class Meta:
ordering = ('slot_id',)
unique_together = ('slot_id', 'robot')
unique_together = [['slot_id', 'robot'], ['medium_id', 'robot']]

def __str__(self):
return str(self.slot_id)
Expand Down

0 comments on commit bae7928

Please sign in to comment.