-
Notifications
You must be signed in to change notification settings - Fork 214
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add text-based URL field, change columns to text * Add migrations
- Loading branch information
1 parent
9b1aa77
commit 125c65e
Showing
7 changed files
with
183 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
# Generated by Django 4.2.11 on 2024-05-10 22:07 | ||
|
||
import api.models.fields | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
('api', '0060_fill_out_help_text'), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='audio_set_foreign_identifier', | ||
field=models.TextField(blank=True, help_text='Reference to set of which this track is a part.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='creator', | ||
field=models.TextField(blank=True, help_text='The name of the media creator.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='creator_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='foreign_identifier', | ||
field=models.TextField(blank=True, db_index=True, help_text='The identifier provided by the upstream source.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='foreign_landing_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The landing page of the work.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='thumbnail', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The thumbnail for the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='title', | ||
field=models.TextField(blank=True, help_text='The name of the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audio', | ||
name='url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='creator', | ||
field=models.TextField(blank=True, help_text='The name of the media creator.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='creator_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='foreign_identifier', | ||
field=models.TextField(blank=True, db_index=True, help_text='The identifier provided by the upstream source.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='foreign_landing_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The landing page of the work.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='thumbnail', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The thumbnail for the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='title', | ||
field=models.TextField(blank=True, help_text='The name of the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='audioset', | ||
name='url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='creator', | ||
field=models.TextField(blank=True, help_text='The name of the media creator.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='creator_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='A direct link to the media creator.', max_length=2000, null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='foreign_identifier', | ||
field=models.TextField(blank=True, db_index=True, help_text='The identifier provided by the upstream source.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='foreign_landing_url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The landing page of the work.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='thumbnail', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The thumbnail for the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='title', | ||
field=models.TextField(blank=True, help_text='The name of the media.', null=True), | ||
), | ||
migrations.AlterField( | ||
model_name='image', | ||
name='url', | ||
field=api.models.fields.URLTextField(blank=True, help_text='The actual URL to the media file.', max_length=1000, null=True, unique=True), | ||
), | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from django import forms | ||
from django.core import validators | ||
from django.db import models | ||
from django.utils.translation import gettext_lazy as _ | ||
|
||
|
||
class URLTextField(models.TextField): | ||
"""URL field which uses the underlying Postgres TEXT column type.""" | ||
|
||
default_validators = [validators.URLValidator()] | ||
description = _("URL") | ||
|
||
def formfield(self, **kwargs): | ||
# As with CharField, this will cause URL validation to be performed | ||
# twice. | ||
return super().formfield( | ||
**{ | ||
"form_class": forms.URLField, | ||
**kwargs, | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
# This file is autogenerated by makemigrations. | ||
# If you have a merge conflict in this file, it means you need to run: | ||
# manage.py makemigrations --merge | ||
# in order to resolve the conflict between migrations. | ||
|
Oops, something went wrong.