changed sponsor logo to be filename only (#280)
* changed sponsor logo to be filename only fixes issue #151 * changed to load logo correctly on sponsor tickets related to fix of issue #151
This commit is contained in:
parent
95cd376f36
commit
9b2640ea07
18
src/sponsors/migrations/0009_sponsor_logo_filename.py
Normal file
18
src/sponsors/migrations/0009_sponsor_logo_filename.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
19
src/sponsors/migrations/0010_populate_logo_filename.py
Normal file
19
src/sponsors/migrations/0010_populate_logo_filename.py
Normal file
|
@ -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),
|
||||||
|
]
|
22
src/sponsors/migrations/0011_auto_20181118_1513.py
Normal file
22
src/sponsors/migrations/0011_auto_20181118_1513.py
Normal file
|
@ -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),
|
||||||
|
),
|
||||||
|
]
|
|
@ -25,9 +25,9 @@ class Sponsor(CampRelatedModel):
|
||||||
help_text='A short description of the sponsorship'
|
help_text='A short description of the sponsorship'
|
||||||
)
|
)
|
||||||
|
|
||||||
logo = models.URLField(
|
logo_filename = models.CharField(
|
||||||
max_length=255,
|
max_length=255,
|
||||||
help_text='A URL to the logo'
|
help_text='Filename of the logo'
|
||||||
)
|
)
|
||||||
|
|
||||||
url = models.URLField(
|
url = models.URLField(
|
||||||
|
|
|
@ -39,7 +39,7 @@ Sponsors | {{ block.super }}
|
||||||
{% if sponsor.url %}
|
{% if sponsor.url %}
|
||||||
<a href="{{ sponsor.url }}">
|
<a href="{{ sponsor.url }}">
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<img class="img-responsive center-block" src="{{ sponsor.logo }}" width="300" />
|
<img class="img-responsive center-block" src="{% static 'img/sponsors/' %}{{ sponsor.logo_filename }}" width="300" />
|
||||||
{% if sponsor.url %}
|
{% if sponsor.url %}
|
||||||
</a>
|
</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
<br>
|
<br>
|
||||||
{% elif ticket.sponsor %}
|
{% elif ticket.sponsor %}
|
||||||
<h3>Sponsor: {{ ticket.sponsor.name }} </h3>
|
<h3>Sponsor: {{ ticket.sponsor.name }} </h3>
|
||||||
<img src="{{ ticket.sponsor.logo }}"></img>
|
<img src="{% static 'img/sponsors/' %}{{ sponsor.logo_filename }}"></img>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ticket.checked_in %}
|
{% if ticket.checked_in %}
|
||||||
<h2>This ticket has been checked in.</h2>
|
<h2>This ticket has been checked in.</h2>
|
||||||
|
|
Loading…
Reference in a new issue