diff --git a/src/sponsors/migrations/0009_sponsor_logo_filename.py b/src/sponsors/migrations/0009_sponsor_logo_filename.py new file mode 100644 index 00000000..14be6a38 --- /dev/null +++ b/src/sponsors/migrations/0009_sponsor_logo_filename.py @@ -0,0 +1,18 @@ +# Generated by Django 2.1.2 on 2018-11-18 13:40 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sponsors', '0008_auto_20180815_1119'), + ] + + operations = [ + migrations.AddField( + model_name='sponsor', + name='logo_filename', + field=models.CharField(blank=True, help_text='Filename of the logo', max_length=255, null=True), + ), + ] diff --git a/src/sponsors/migrations/0010_populate_logo_filename.py b/src/sponsors/migrations/0010_populate_logo_filename.py new file mode 100644 index 00000000..5d0bedd7 --- /dev/null +++ b/src/sponsors/migrations/0010_populate_logo_filename.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.2 on 2018-11-18 13:42 + +from django.db import migrations + +def populate_logo_filename(apps, schema_editor): + Sponsor = apps.get_model('sponsors', 'Sponsor') + for sponsor in Sponsor.objects.all(): + sponsor.logo_filename = sponsor.logo.split("/")[-1] + sponsor.save() + +class Migration(migrations.Migration): + + dependencies = [ + ('sponsors', '0009_sponsor_logo_filename'), + ] + + operations = [ + migrations.RunPython(populate_logo_filename), + ] diff --git a/src/sponsors/migrations/0011_auto_20181118_1513.py b/src/sponsors/migrations/0011_auto_20181118_1513.py new file mode 100644 index 00000000..9cee6d9d --- /dev/null +++ b/src/sponsors/migrations/0011_auto_20181118_1513.py @@ -0,0 +1,22 @@ +# Generated by Django 2.1.2 on 2018-11-18 14:13 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('sponsors', '0010_populate_logo_filename'), + ] + + operations = [ + migrations.RemoveField( + model_name='sponsor', + name='logo', + ), + migrations.AlterField( + model_name='sponsor', + name='logo_filename', + field=models.CharField(help_text='Filename of the logo', max_length=255), + ), + ] diff --git a/src/sponsors/models.py b/src/sponsors/models.py index 3edd2acf..d7ab4a45 100644 --- a/src/sponsors/models.py +++ b/src/sponsors/models.py @@ -25,9 +25,9 @@ class Sponsor(CampRelatedModel): help_text='A short description of the sponsorship' ) - logo = models.URLField( + logo_filename = models.CharField( max_length=255, - help_text='A URL to the logo' + help_text='Filename of the logo' ) url = models.URLField( diff --git a/src/sponsors/templates/sponsors.html b/src/sponsors/templates/sponsors.html index 8eab99f8..fb506c53 100644 --- a/src/sponsors/templates/sponsors.html +++ b/src/sponsors/templates/sponsors.html @@ -39,7 +39,7 @@ Sponsors | {{ block.super }} {% if sponsor.url %} {% endif %} - + {% if sponsor.url %} {% endif %} diff --git a/src/tickets/templates/pdf/ticket.html b/src/tickets/templates/pdf/ticket.html index 9acc9dba..7623325e 100644 --- a/src/tickets/templates/pdf/ticket.html +++ b/src/tickets/templates/pdf/ticket.html @@ -23,7 +23,7 @@
{% elif ticket.sponsor %}

Sponsor: {{ ticket.sponsor.name }}

- + {% endif %} {% if ticket.checked_in %}

This ticket has been checked in.