@@ -170,21 +170,41 @@ def get_tabset_data(self):
170
170
tab_data = {
171
171
"icon_class" : tab_definition .get ("icon_class" ),
172
172
"template" : tab_definition .get ("template" ),
173
+ "fields" : self .get_fields_with_values (tab_definition .get ("fields" ))
173
174
}
174
-
175
- fields = tab_definition .get ("fields" )
176
- fields_with_values = {}
177
- for field_name in fields :
178
- field_value = getattr (self .object , field_name , None )
179
- if isinstance (field_value , list ):
180
- field_value = "\n " .join (field_value )
181
- fields_with_values [field_name ] = field_value
182
- tab_data ["fields" ] = fields_with_values
183
-
184
175
tabset_data [label ] = tab_data
185
176
186
177
return tabset_data
187
178
179
+ def get_fields_with_values (self , fields ):
180
+ """
181
+ Returns the tab fields including their values for display.
182
+ """
183
+ fields_with_values = {}
184
+
185
+ for field_name in fields :
186
+ fields_with_values [field_name ] = self .get_field_data (field_name )
187
+
188
+ return fields_with_values
189
+
190
+ def get_field_data (self , field_name ):
191
+ """
192
+ Returns the formatted value for the given `field_name` on the current object.
193
+ """
194
+ field_value = getattr (self .object , field_name , None )
195
+ if isinstance (field_value , list ):
196
+ field_value = "\n " .join (field_value )
197
+ return field_value
198
+
199
+ # @staticmethod
200
+ # def get_field_label(field_name):
201
+ # return (
202
+ # field_name
203
+ # .replace("_", " ")
204
+ # .capitalize()
205
+ # .replace("url", "URL")
206
+ # )
207
+
188
208
def get_context_data (self , ** kwargs ):
189
209
context = super ().get_context_data (** kwargs )
190
210
context ["tabset_data" ] = self .get_tabset_data ()
@@ -711,7 +731,7 @@ class DiscoveredPackageDetailsView(
711
731
tabset = {
712
732
"essentials" : {
713
733
"fields" : [
714
- "purl " ,
734
+ "package_url " ,
715
735
"license_expression" ,
716
736
"primary_language" ,
717
737
"homepage_url" ,
0 commit comments