Skip to content

Commit

Permalink
FIND-739 Fix problem with import/export in admin
Browse files Browse the repository at this point in the history
  • Loading branch information
TraMZzz committed Feb 21, 2025
1 parent 8e55e42 commit 9d6c3e8
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions submission/admin/sample_alias.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ class Meta:
"origin_label",
)

def __init__(self):
def __init__(self, **kwargs):
"""Initialize the package field."""
super().__init__()
super().__init__(**kwargs)
self.package = None

def before_import(self, dataset, **kwargs): # pylint: disable=unused-argument, duplicate-code
Expand All @@ -68,9 +68,7 @@ def before_import(self, dataset, **kwargs): # pylint: disable=unused-argument,

package.save()

def before_save_instance(
self, instance, row, **kwargs
): # pylint: disable=unused-argument, duplicate-code
def before_save_instance(self, instance, row, **kwargs): # pylint: disable=unused-argument, duplicate-code
"""Set the package and created_at fields for the imported samples."""
instance.package = self.package
instance.created_at = date.today()
Expand All @@ -83,7 +81,6 @@ class SampleAliasAdmin(ImportExportModelAdmin):

raw_id_fields = [
"sample",
# "assoc_packages",
]

search_fields = [
Expand Down

0 comments on commit 9d6c3e8

Please sign in to comment.