From 8eeeedaff2e09c7e9ef59aa65154bc0f60daeec0 Mon Sep 17 00:00:00 2001 From: Fabricio Aguiar Date: Thu, 27 Aug 2020 18:39:34 -0300 Subject: [PATCH] Replace URLField with CharField https://pulp.plan.io/issues/7353 closes #7353 --- CHANGES/7353.bugfix | 1 + .../migrations/0022_URLField_to_CharField.py | 33 +++++++++++++++++++ pulp_ansible/app/models.py | 16 ++++----- pulp_ansible/app/serializers.py | 8 ++--- 4 files changed, 46 insertions(+), 12 deletions(-) create mode 100644 CHANGES/7353.bugfix create mode 100644 pulp_ansible/app/migrations/0022_URLField_to_CharField.py diff --git a/CHANGES/7353.bugfix b/CHANGES/7353.bugfix new file mode 100644 index 000000000..3d8a88eb6 --- /dev/null +++ b/CHANGES/7353.bugfix @@ -0,0 +1 @@ +Replace URLField with CharField diff --git a/pulp_ansible/app/migrations/0022_URLField_to_CharField.py b/pulp_ansible/app/migrations/0022_URLField_to_CharField.py new file mode 100644 index 000000000..f4bc143ab --- /dev/null +++ b/pulp_ansible/app/migrations/0022_URLField_to_CharField.py @@ -0,0 +1,33 @@ +# Generated by Django 2.2.15 on 2020-08-27 21:37 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('ansible', '0021_rename_role_remote'), + ] + + operations = [ + migrations.AlterField( + model_name='collectionversion', + name='documentation', + field=models.CharField(blank=True, default='', editable=False, max_length=2000), + ), + migrations.AlterField( + model_name='collectionversion', + name='homepage', + field=models.CharField(blank=True, default='', editable=False, max_length=2000), + ), + migrations.AlterField( + model_name='collectionversion', + name='issues', + field=models.CharField(blank=True, default='', editable=False, max_length=2000), + ), + migrations.AlterField( + model_name='collectionversion', + name='repository', + field=models.CharField(blank=True, default='', editable=False, max_length=2000), + ), + ] diff --git a/pulp_ansible/app/models.py b/pulp_ansible/app/models.py index 4ddc40dfa..4e373c7e9 100644 --- a/pulp_ansible/app/models.py +++ b/pulp_ansible/app/models.py @@ -108,13 +108,13 @@ class CollectionVersion(Content): description (models.TextField): A short summary description of the collection. docs_blob (psql_fields.JSONField): A JSON field holding the various documentation blobs in the collection. - documentation (models.URLField): The URL to any online docs. - homepage (models.URLField): The URL to the homepage of the collection/project. - issues (models.URLField): The URL to the collection issue tracker. + documentation (models.CharField): The URL to any online docs. + homepage (models.CharField): The URL to the homepage of the collection/project. + issues (models.CharField): The URL to the collection issue tracker. license (psql_fields.ArrayField): A list of licenses for content inside of a collection. name (models.CharField): The name of the collection. namespace (models.CharField): The namespace of the collection. - repository (models.URLField): The URL of the originating SCM repository. + repository (models.CharField): The URL of the originating SCM repository. version (models.CharField): The version of the collection. is_highest (models.BooleanField): Indicates that the version is the highest one in the collection. @@ -140,13 +140,13 @@ class CollectionVersion(Content): dependencies = psql_fields.JSONField(default=dict, editable=False) description = models.TextField(default="", blank=True, editable=False) docs_blob = psql_fields.JSONField(default=dict, editable=False) - documentation = models.URLField(default="", blank=True, max_length=2000, editable=False) - homepage = models.URLField(default="", blank=True, max_length=2000, editable=False) - issues = models.URLField(default="", blank=True, max_length=2000, editable=False) + documentation = models.CharField(default="", blank=True, max_length=2000, editable=False) + homepage = models.CharField(default="", blank=True, max_length=2000, editable=False) + issues = models.CharField(default="", blank=True, max_length=2000, editable=False) license = psql_fields.ArrayField(models.CharField(max_length=32), default=list, editable=False) name = models.CharField(max_length=64, editable=False) namespace = models.CharField(max_length=32, editable=False) - repository = models.URLField(default="", blank=True, max_length=2000, editable=False) + repository = models.CharField(default="", blank=True, max_length=2000, editable=False) version = models.CharField(max_length=32, editable=False) is_highest = models.BooleanField(editable=False, default=False) diff --git a/pulp_ansible/app/serializers.py b/pulp_ansible/app/serializers.py index 71bee05d1..73b561d8f 100644 --- a/pulp_ansible/app/serializers.py +++ b/pulp_ansible/app/serializers.py @@ -285,17 +285,17 @@ class CollectionVersionSerializer(SingleArtifactContentSerializer, ContentChecks help_text=_("A JSON field holding the various documentation blobs in the collection.") ) - documentation = serializers.URLField( + documentation = serializers.CharField( help_text=_("The URL to any online docs."), allow_blank=True, max_length=2000 ) - homepage = serializers.URLField( + homepage = serializers.CharField( help_text=_("The URL to the homepage of the collection/project."), allow_blank=True, max_length=2000, ) - issues = serializers.URLField( + issues = serializers.CharField( help_text=_("The URL to the collection issue tracker."), allow_blank=True, max_length=2000 ) @@ -312,7 +312,7 @@ class CollectionVersionSerializer(SingleArtifactContentSerializer, ContentChecks help_text=_("The namespace of the collection."), max_length=32 ) - repository = serializers.URLField( + repository = serializers.CharField( help_text=_("The URL of the originating SCM repository."), allow_blank=True, max_length=2000 )