Skip to content

Commit 782497a

Browse files
committed
Add is_locked field on the Product model #310
Signed-off-by: tdruez <[email protected]>
1 parent 5014ff5 commit 782497a

File tree

7 files changed

+50
-1
lines changed

7 files changed

+50
-1
lines changed

dje/tests/testfiles/test_dataset_pp_only.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@
9494
"notice_text": "Starship Widget Framework (SWF) \nis an adaptation of the open source\nOZONE Widget Framework (OWF)\n\nPortions of this software were developed under contract to the U.S. Government, and are made available pursuant to the DFARS clauses cited below.\n\nCopyright 2009-2012, Next Century Corporation.\nThe U.S. Government has Unlimited Rights in this computer software pursuant to\nthe clause DFARS 252.227-7014 of contract no. H98230-07-C-0614. Any\nreproduction of this computer software, or portions thereof, marked with this\nlegend must also reproduce these markings.\n\nCopyright 2009-2010, Texeltek Inc.\nThe U.S. Government has Unlimited Rights in this computer software pursuant to\nthe clause DFARS 252.227-7014 of contract no. H98230-07-C-0046. Any\nreproduction of this computer software, or portions thereof, marked with this\nlegend must also reproduce these markings.\n\nThis product further may include software developed by other individuals, entities, or agencies. These groups have granted rights to the OWFGOSS Board to apply that code in the OWF or Marketplace code baselines, without further claim or copyright.\n\nThe product further references the following libraries or capabilities which are NOT included as part of this copyright statement, and are hereby listed with their license terms.\n* Ext JS, developed by Sencha, licensed under GNU General Public License, Version 3, http://www.gnu.org/licenses/gpl.html \n* Grails and its supporting capabilities, including Groovy, Hibernate, and Spring. Available at grails.org, licensed Apache License, Version 2.0, http://grails.org/License\n* YUI Compressor Javascript/CSS compressor , http://yuilibrary.com/license/ (based on BSD license)\n* Dojo cross-domain library, Dojo BSD License, http://dojotoolkit.org/license\n* Shindig messaging library, http://shindig.apache.org/, Apache License, Version 2.0, http://www.apache.org/licenses/\n* JQuery Ajax/eventing library, http://jquery.com, based on MIT License, https://raw.github.com/jquery/jquery/master/MIT-LICENSE.txt\n* Spring Security jars, licensed under Apache License, Version 2, http://www.apache.org/licenses/ \n* log4javascript logging library, http://log4javascript.org, Apache License, Version 2.0, http://www.apache.org/licenses/\n* stubconsole logging utility, http://getfirebug.com/firebug/firebugx.js, Firebug BSD License, http://fbug.googlecode.com/svn/trunk/license.txt\n* UXMedia, Ext Flash / Flex components, see http://code.google.com/p/uxmedia. GNU General Public License, Version 3, http://www.gnu.org/licenses/gpl.html \n",
9595
"license_expression": "commercial-option",
9696
"is_active": true,
97+
"is_locked": false,
9798
"configuration_status": [
9899
"nexB",
99100
"addd9c5d-a5ec-48ec-a565-ddb81092f49d"

product_portfolio/admin.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ class ProductAdmin(
317317
AsLink("owner"),
318318
AsJoinList("keywords", "<br>", short_description="Keywords"),
319319
"is_active",
320+
"is_locked",
320321
"configuration_status",
321322
"primary_language",
322323
"contact",
@@ -332,6 +333,7 @@ class ProductAdmin(
332333
ReportingQueryListFilter,
333334
("configuration_status", LimitToDataspaceListFilter),
334335
"is_active",
336+
"is_locked",
335337
)
336338
search_fields = (
337339
"name",
@@ -364,6 +366,7 @@ class ProductAdmin(
364366
"primary_language",
365367
"admin_notes",
366368
"is_active",
369+
"is_locked",
367370
"configuration_status",
368371
"contact",
369372
"vulnerabilities_risk_threshold",

product_portfolio/api.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ class Meta:
119119
"name",
120120
"version",
121121
"owner",
122+
"is_locked",
122123
"configuration_status",
123124
"license_expression",
124125
"licenses",

product_portfolio/filters.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ class Meta:
126126
"primary_language",
127127
"configuration_status",
128128
"keywords",
129+
"is_locked",
129130
]
130131

131132

product_portfolio/forms.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ class Meta:
123123
"homepage_url",
124124
"primary_language",
125125
"is_active",
126+
"is_locked",
126127
"configuration_status",
127128
"contact",
128129
"keywords",
@@ -177,7 +178,7 @@ def helper(self):
177178
Group("description", "keywords"),
178179
Group("primary_language", "homepage_url", "contact"),
179180
HTML("<hr>"),
180-
Group("is_active", "configuration_status", "release_date"),
181+
Group("is_active", "is_locked", "configuration_status", "release_date"),
181182
HTML("<hr>"),
182183
Group("vulnerabilities_risk_threshold", HTML(""), HTML("")),
183184
HTML("<hr>"),
@@ -249,6 +250,8 @@ class Meta:
249250
"homepage_url",
250251
"primary_language",
251252
"admin_notes",
253+
"is_active",
254+
"is_locked",
252255
"configuration_status",
253256
"contact",
254257
"vcs_url",
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# Generated by Django 5.1.9 on 2025-05-30 07:11
2+
3+
import django.db.models.deletion
4+
from django.db import migrations, models
5+
6+
7+
class Migration(migrations.Migration):
8+
9+
dependencies = [
10+
('component_catalog', '0011_alter_component_owner'),
11+
('product_portfolio', '0012_alter_scancodeproject_status_and_more'),
12+
]
13+
14+
operations = [
15+
migrations.AddField(
16+
model_name='product',
17+
name='is_locked',
18+
field=models.BooleanField(db_index=True, default=False, help_text='Marks this product vertsion as read-only, preventing any modifications to its inventory.', verbose_name='Locked'),
19+
),
20+
migrations.AlterField(
21+
model_name='productdependency',
22+
name='for_package',
23+
field=models.ForeignKey(blank=True, help_text='The package that declares this dependency.', null=True, on_delete=django.db.models.deletion.CASCADE, related_name='declared_dependencies', to='component_catalog.package'),
24+
),
25+
migrations.AlterField(
26+
model_name='productdependency',
27+
name='resolved_to_package',
28+
field=models.ForeignKey(blank=True, help_text='The resolved package for this dependency. If empty, it indicates the dependency is unresolved.', null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='resolved_from_dependencies', to='component_catalog.package'),
29+
),
30+
]

product_portfolio/models.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,6 +221,16 @@ class Product(BaseProductMixin, FieldChangesMixin, KeywordsMixin, DataspacedMode
221221
),
222222
)
223223

224+
is_locked = models.BooleanField(
225+
verbose_name=_("Locked"),
226+
default=False,
227+
db_index=True,
228+
help_text=_(
229+
"Marks this product vertsion as read-only, preventing any modifications to "
230+
"its inventory."
231+
),
232+
)
233+
224234
configuration_status = models.ForeignKey(
225235
to="product_portfolio.ProductStatus",
226236
on_delete=models.PROTECT,

0 commit comments

Comments
 (0)