diff --git a/app/management/commands/import.py b/app/management/commands/import.py index aa575eb..463c88e 100644 --- a/app/management/commands/import.py +++ b/app/management/commands/import.py @@ -411,6 +411,8 @@ class Command(BaseCommand): def handle_object_dict(object_dict, model_name): + if model_name == 'Resource': + object_dict['url'] = object_dict['url'].strip("#") if model_name == 'Range': # Reinstate range_name key object_dict['range_name'] = object_dict['range_name_id'] diff --git a/app/migrations/0025_alter_resource_url.py b/app/migrations/0025_alter_resource_url.py new file mode 100644 index 0000000..4f4a3ec --- /dev/null +++ b/app/migrations/0025_alter_resource_url.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.5 on 2021-11-26 11:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('app', '0024_alter_resource_stars'), + ] + + operations = [ + migrations.AlterField( + model_name='resource', + name='url', + field=models.URLField(blank=True, null=True), + ), + ] diff --git a/app/models.py b/app/models.py index 533463a..63559ca 100644 --- a/app/models.py +++ b/app/models.py @@ -159,7 +159,7 @@ class Resource(models.Model): id = models.AutoField(primary_key=True) source_id = models.IntegerField(blank=True, null=True) title = models.TextField(blank=True, null=True) - url = models.TextField(blank=True, null=True) + url = models.URLField(blank=True, null=True) citation = models.TextField(blank=True, null=True) abstract = models.TextField(blank=True, null=True)