We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents c966823 + e2ed8f2 commit da02f18Copy full SHA for da02f18
src/packageurl/contrib/django_models.py
@@ -109,3 +109,15 @@ def package_url(self):
109
except ValueError:
110
return ''
111
return str(purl)
112
+
113
+ def set_package_url(self, package_url):
114
+ """
115
+ Set values for each related field of the provided `package_url` string.
116
+ Empty/Null values are normalized to `None` and are set as well
117
+ to replace any existing values.
118
+ This prevent mixing newly provided values with old ones.
119
120
+ purl = PackageURL.from_string(package_url)
121
122
+ for field_name, value in purl.to_dict().items():
123
+ setattr(self, field_name, value or None)
0 commit comments