Skip to content

Commit

Permalink
Merge pull request #246 from ItsCalebJones/fix_events_images
Browse files Browse the repository at this point in the history
fix: events page load times and remove twitter widget
  • Loading branch information
ItsCalebJones committed Apr 18, 2024
2 parents af0c83f + 669e297 commit 12d0566
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 25 deletions.
8 changes: 0 additions & 8 deletions src/web/templates/web/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,6 @@
<li class="nav-item">
<a class="nav-link" href="/launch">Launches</a>
</li>
<li class="nav-item">
<a class="nav-link twitter" href="https://twitter.com/SpaceLaunchNow"><i
class="fab fa-twitter"></i></a>
</li>

<li class="nav-item">
<a class="nav-link" href="/api/3.3.0">API</a>
</li>
</ul>
</div>
</div>
Expand Down
9 changes: 0 additions & 9 deletions src/web/templates/web/events/event_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -94,15 +94,6 @@ <h3 class="card-title">
{% if event.location %}
<span class="badge badge-pill badge-primary">{{ event.location }}</span>
{% endif %}
{% if event.spacestation %}
<span class="badge badge-pill badge-info">{{ event.spacestation.first.name }}</span>
{% endif %}
{% if event.launch %}
<span class="badge badge-pill badge-warning">{{ event.launch.first.name }}</span>
{% endif %}
{% if event.expedition %}
<span class="badge badge-pill badge-info">{{ event.expedition.first.name }}</span>
{% endif %}
<br>
<p class="card-description mt-1">
{{ event.description|truncatewords:150 }}
Expand Down
7 changes: 0 additions & 7 deletions src/web/templates/web/sidebar_full.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,6 @@
<script>
(adsbygoogle = window.adsbygoogle || []).push({});
</script>
<div class="card" style="height: 1500px;">
<a class="twitter-timeline" data-height="1500" data-link-color="#981CEB"
href="https://twitter.com/SpaceLaunchNow/lists/space-launch-news?ref_src=twsrc%5Etfw">Space
Launch
News</a>
<script async src="https://platform.twitter.com/widgets.js" charset="utf-8"></script>
</div>
<iframe src="https://discordapp.com/widget?id=380226438584074242&theme=dark"
width="100%" height="500"
allowtransparency="true"
Expand Down
7 changes: 6 additions & 1 deletion src/web/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,12 @@ def spacecraft_by_id(request, id):
@cache_page(600)
def events_list(request):
last_six_hours = UTC_NOW - timedelta(hours=6)
events = Events.objects.all().filter(date__gte=last_six_hours).order_by("date")
events = (
Events.objects.filter(date__gte=last_six_hours)
.select_related("type")
.order_by("date")
.values("id", "name", "date", "type__name", "slug", "description", "image", "location")
)
previous_launches = get_prefetched_launch_queryset(Launch.objects.filter(net__lte=UTC_NOW)).order_by("-net")[:6]
return render(
request,
Expand Down

0 comments on commit 12d0566

Please sign in to comment.