Make url URLField

This commit is contained in:
PCoder 2021-11-26 16:47:09 +05:30
parent 0bbe1fd80d
commit 8b2508fbc5
3 changed files with 21 additions and 1 deletions

View File

@ -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']

View File

@ -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),
),
]

View File

@ -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)