SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 4e7c99ba authored by Jean-Sébastien Caux's avatar Jean-Sébastien Caux
Browse files

Add logo to AffiliateJournal

parent 0af8f430
No related branches found
No related tags found
No related merge requests found
# Generated by Django 3.2.12 on 2022-03-04 18:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('affiliates', '0009_auto_20220226_2037'),
]
operations = [
migrations.AddField(
model_name='affiliatejournal',
name='logo',
field=models.ImageField(blank=True, upload_to='affiliates/journals/logos/'),
),
]
# Generated by Django 3.2.12 on 2022-03-04 18:52
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('ontology', '0007_Branch_Field_Specialty'),
('affiliates', '0010_affiliatejournal_logo'),
]
operations = [
migrations.AddField(
model_name='affiliatejournal',
name='acad_field',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, to='ontology.academicfield'),
),
migrations.AddField(
model_name='affiliatejournal',
name='specialties',
field=models.ManyToManyField(blank=True, to='ontology.Specialty'),
),
]
......@@ -33,8 +33,18 @@ class AffiliateJournal(models.Model):
],
unique=True,
)
acad_field = models.ForeignKey(
"ontology.AcademicField", on_delete=models.PROTECT, blank=True, null=True,
)
specialties = models.ManyToManyField(
"ontology.Specialty", blank=True,
)
homepage = models.URLField(max_length=256, blank=True)
logo = models.ImageField(upload_to="affiliates/journals/logos/", blank=True)
# Cost per publication information
cost_info = models.JSONField(default=cost_default_value)
......
......@@ -20,12 +20,20 @@
<div class="row p-2">
<div class="col">
{% if object.logo %}
<img class="rounded m-4" style="max-height: 16rem; max-width: 32rem;"
src="{{ object.logo.url }}" alt="{{ object.name }} logo">
{% endif %}
<h3>Journal information</h3>
<table class="table">
<tr>
<th>Homepage</th>
<td>{% if object.homepage %}<a href="{{ object.homepage }}" target="_blank">{{ object.homepage }}&emsp;{% include 'bi/box-arrow-up-right.html' %}</a>{% else %}(not defined){% endif %}</td>
</tr>
<tr>
<th>Academic field</th>
<td>{% if journal.acad_field %}{{ journal.acad_field }}{% else %}(unspecified){% endif %}</td>
</tr>
</table>
</div>
</div>
......
......@@ -11,12 +11,24 @@
<h2 class="highlight">Affiliate Journals</h2>
<ul>
<table class="table align-middle">
{% for journal in object_list %}
<li><a href="{{ journal.get_absolute_url }}">{{ journal }}</a></li>
<tr>
<td><a href="{{ journal.get_absolute_url }}">{{ journal }}</a></li></td>
<td>
{% if journal.logo %}
<img class="rounded" style="max-height: 8rem; max-width: 16rem;"
src="{{ journal.logo.url }}" alt="{{ journal.name }} logo">
{% endif %}
</td>
<td>{{ journal.acad_field }}</td>
</tr>
{% empty %}
<li>There are no affiliate journals at this moment</li>
<tr>
<td></td>
<td>There are no affiliate journals at this moment</td>
</tr>
{% endfor %}
</ul>
</table>
{% endblock content %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment