3434from django .utils .formats import date_format
3535from django .utils .html import escape
3636from django .utils .html import format_html
37+ from django .utils .text import normalize_newlines
3738from django .utils .translation import gettext
3839from django .utils .translation import gettext_lazy as _
3940from django .views .decorators .csrf import csrf_exempt
@@ -1147,8 +1148,8 @@ class PackageDetailsView(
11471148 AcceptAnonymousMixin ,
11481149 AddPackagePermissionMixin ,
11491150 TabVulnerabilityMixin ,
1150- ObjectDetailsView ,
11511151 AddToProductFormMixin ,
1152+ ObjectDetailsView ,
11521153):
11531154 model = Package
11541155 slug_url_kwarg = "uuid"
@@ -1247,6 +1248,9 @@ class PackageDetailsView(
12471248 "vulnerabilities" : {
12481249 "verbose_name" : "Vulnerabilities" ,
12491250 },
1251+ "aboutcode" : {
1252+ "verbose_name" : "AboutCode" ,
1253+ },
12501254 "history" : {
12511255 "fields" : [
12521256 "created_date" ,
@@ -1266,8 +1270,7 @@ def get_context_data(self, **kwargs):
12661270 has_change_package_permission = user .has_perm ("component_catalog.change_package" )
12671271 context_data ["has_change_package_permission" ] = has_change_package_permission
12681272
1269- # License data is required for the Scan tab "scan to package"
1270- # license expression fields
1273+ # License data is required for the Scan tab "scan to package" license expression fields
12711274 client_data = getattr (self .request , "client_data" , {})
12721275 include_all_licenses = all (
12731276 [
@@ -1280,9 +1283,9 @@ def get_context_data(self, **kwargs):
12801283 all_licenses = License .objects .scope (user .dataspace ).filter (is_active = True )
12811284 add_client_data (self .request , license_data = all_licenses .data_for_expression_builder ())
12821285
1283- if self . request . user .has_perm ("component_catalog.change_component" ):
1286+ if user .has_perm ("component_catalog.change_component" ):
12841287 context_data ["add_to_component_form" ] = AddToComponentForm (
1285- self . request . user , initial = {self .model ._meta .model_name : self .object }
1288+ user , initial = {self .model ._meta .model_name : self .object }
12861289 )
12871290
12881291 return context_data
@@ -1447,6 +1450,15 @@ def tab_purldb(self):
14471450 }
14481451 return {"fields" : [(None , tab_context , None , template )]}
14491452
1453+ def tab_aboutcode (self ):
1454+ template = "component_catalog/tabs/tab_aboutcode.html"
1455+ context = {
1456+ "about_content" : self .object .as_about_yaml (),
1457+ "notice_content" : normalize_newlines (self .object .notice_text ),
1458+ }
1459+
1460+ return {"fields" : [(None , context , None , template )]}
1461+
14501462 def get_vulnerabilities_tab_fields (self , vulnerabilities ):
14511463 dataspace = self .object .dataspace
14521464 fields = []
0 commit comments