-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement board member details as snippet
- Loading branch information
Showing
16 changed files
with
500 additions
and
200 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
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,132 @@ | ||
# Generated by Django 3.2.25 on 2024-12-20 15:25 | ||
|
||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
import wagtail.fields | ||
import wagtail.models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
("wagtailimages", "0025_alter_image_file_alter_rendition_file"), | ||
("wagtailcore", "0089_log_entry_data_json_null_to_object"), | ||
("lametro", "0017_alter_alert_description"), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name="BoardMemberDetails", | ||
fields=[ | ||
( | ||
"id", | ||
models.AutoField( | ||
auto_created=True, | ||
primary_key=True, | ||
serialize=False, | ||
verbose_name="ID", | ||
), | ||
), | ||
( | ||
"live", | ||
models.BooleanField( | ||
default=True, editable=False, verbose_name="live" | ||
), | ||
), | ||
( | ||
"has_unpublished_changes", | ||
models.BooleanField( | ||
default=False, | ||
editable=False, | ||
verbose_name="has unpublished changes", | ||
), | ||
), | ||
( | ||
"first_published_at", | ||
models.DateTimeField( | ||
blank=True, | ||
db_index=True, | ||
null=True, | ||
verbose_name="first published at", | ||
), | ||
), | ||
( | ||
"last_published_at", | ||
models.DateTimeField( | ||
editable=False, null=True, verbose_name="last published at" | ||
), | ||
), | ||
( | ||
"go_live_at", | ||
models.DateTimeField( | ||
blank=True, null=True, verbose_name="go live date/time" | ||
), | ||
), | ||
( | ||
"expire_at", | ||
models.DateTimeField( | ||
blank=True, null=True, verbose_name="expiry date/time" | ||
), | ||
), | ||
( | ||
"expired", | ||
models.BooleanField( | ||
default=False, editable=False, verbose_name="expired" | ||
), | ||
), | ||
( | ||
"headshot_source", | ||
models.CharField( | ||
blank=True, default="Metro", max_length=256, null=True | ||
), | ||
), | ||
("bio", wagtail.fields.RichTextField(blank=True, null=True)), | ||
( | ||
"headshot", | ||
models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="wagtailimages.image", | ||
), | ||
), | ||
( | ||
"latest_revision", | ||
models.ForeignKey( | ||
blank=True, | ||
editable=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="wagtailcore.revision", | ||
verbose_name="latest revision", | ||
), | ||
), | ||
( | ||
"live_revision", | ||
models.ForeignKey( | ||
blank=True, | ||
editable=False, | ||
null=True, | ||
on_delete=django.db.models.deletion.SET_NULL, | ||
related_name="+", | ||
to="wagtailcore.revision", | ||
verbose_name="live revision", | ||
), | ||
), | ||
( | ||
"person", | ||
models.OneToOneField( | ||
on_delete=django.db.models.deletion.CASCADE, | ||
related_name="details", | ||
to="lametro.lametroperson", | ||
), | ||
), | ||
], | ||
options={ | ||
"verbose_name_plural": "Board Member Details", | ||
}, | ||
bases=(wagtail.models.PreviewableMixin, models.Model), | ||
), | ||
] |
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,12 @@ | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
|
||
from lametro.models import LAMetroPerson, BoardMemberDetails | ||
|
||
|
||
@receiver(post_save, sender=LAMetroPerson) | ||
def create_member_details(sender, instance, created, **kwargs): | ||
details_exist = BoardMemberDetails.objects.filter(person=instance).exists() | ||
|
||
if not details_exist: | ||
BoardMemberDetails.objects.create(person=instance) |
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
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,11 @@ | ||
{% load static wagtailimages_tags %} | ||
|
||
{% if person.details.headshot %} | ||
{% if original %} | ||
{% image person.details.headshot width-640 class="img-fluid rounded-3 p-1" alt=person.name %} | ||
{% else %} | ||
{% image person.details.headshot fill-100x100 class="img-fluid rounded-3 p-1" alt=person.name %} | ||
{% endif %} | ||
{% else %} | ||
<img src='{% static "images/headshot_placeholder.png" %}' alt="{{person.name}}" title="{{person.name}}" class="img-fluid rounded-3 p-1" id="person-detail-headshot" /> | ||
{% endif %} |
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 |
---|---|---|
@@ -1,27 +1,38 @@ | ||
{% load extras %} | ||
{% load lametro_extras %} | ||
{% load lametro_extras wagtailcore_tags %} | ||
|
||
|
||
<div class="row"> | ||
<div class="col-md-4"> | ||
<img src='{{person.headshot_url}}' alt='{{person.name}}' title='{{person.name}}' class='img-responsive img-thumbnail img-padded' id="person-detail-headshot" /> | ||
<div class="col-sm-4 col-md-12"> | ||
{% include "common/headshot.html" %} | ||
{% if person_details.headshot %} | ||
<p class="small"> | ||
<i class="fa fa-fw fa-camera" aria-hidden="true"></i> | ||
Credit: {{person_details.headshot_source}} | ||
</p> | ||
{% endif %} | ||
</div> | ||
|
||
<div class="col-sm-6 col-md-12 mt-3 mt-md-0"> | ||
{% if qualifying_post %} | ||
<p class="small mb-1"> | ||
<i class='fa fa-fw fa-briefcase' aria-hidden="true"></i> | ||
{{ qualifying_post | appointment_label }} | ||
</p> | ||
{% endif %} | ||
|
||
{% if person.headshot_source %} | ||
<p class='small mb-1'> | ||
<i class='fa fa-fw fa-camera' aria-hidden="true"></i> | ||
Credit: {{person.headshot_source}} | ||
</p> | ||
{% endif %} | ||
</div> | ||
<p class="small"> | ||
<a href="/about/#about-la-metro"> | ||
<i class="fa fa-info-circle" aria-hidden="true"></i> | ||
More about Metro appointments | ||
</a> | ||
</p> | ||
</div> | ||
|
||
<div class="col-md-8 mt-3"> | ||
<h3>About {{ ceo.name }}</h3> | ||
<p>{{ member_bio | safe }}</p> | ||
</div> | ||
{% if person_details.bio %} | ||
<div class="col-md-8 mt-3"> | ||
<h3>About {{ person.name }}</h3> | ||
<p>{{ person_details.bio | richtext }}</p> | ||
</div> | ||
{% endif %} | ||
</div> |
Oops, something went wrong.