From 4013815a04c7ece11c68f0c571007f33c18285e2 Mon Sep 17 00:00:00 2001 From: zandercymatics <141044360+zandercymatics@users.noreply.github.com> Date: Mon, 25 Nov 2024 15:33:47 -0700 Subject: [PATCH] Update csv_export.py --- src/registrar/utility/csv_export.py | 44 ++++++++++++++--------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/src/registrar/utility/csv_export.py b/src/registrar/utility/csv_export.py index 286b970ce..916242682 100644 --- a/src/registrar/utility/csv_export.py +++ b/src/registrar/utility/csv_export.py @@ -88,6 +88,13 @@ class BaseExport(ABC): """ pass + @classmethod + def get_columns(cls): + """ + Returns the columns for CSV export. Override in subclasses as needed. + """ + return [] + @classmethod def get_sort_fields(cls): """ @@ -152,6 +159,21 @@ class BaseExport(ABC): Get a list of fields from related tables. """ return [] + + @classmethod + def update_queryset(cls, queryset, **kwargs): + """ + Returns an updated queryset. Override in subclass to update queryset. + """ + return queryset + + @classmethod + def write_csv_before(cls, csv_writer, **kwargs): + """ + Write to csv file before the write_csv method. + Override in subclasses where needed. + """ + pass @classmethod def annotate_and_retrieve_fields( @@ -218,32 +240,10 @@ class BaseExport(ABC): ) return cls.annotate_and_retrieve_fields(model_queryset, annotated_fields, related_table_fields, **kwargs) - @classmethod - def update_queryset(cls, queryset, **kwargs): - """ - Returns an updated queryset. Override in subclass to update queryset. - """ - return queryset - @classmethod def get_model_annotation_dict(cls, **kwargs): return convert_queryset_to_dict(cls.get_annotated_queryset(**kwargs), is_model=False) - @classmethod - def get_columns(cls): - """ - Returns the columns for CSV export. Override in subclasses as needed. - """ - return [] - - @classmethod - def write_csv_before(cls, csv_writer, **kwargs): - """ - Write to csv file before the write_csv method. - Override in subclasses where needed. - """ - pass - @classmethod def export_data_to_csv(cls, csv_file, **kwargs): """