Skip to content

Commit

Permalink
Merge pull request #4412 from freelawproject/dependabot/pip/django-5.1.1
Browse files Browse the repository at this point in the history
build(deps): bump django from 5.0.8 to 5.1.1
  • Loading branch information
mlissner authored Sep 13, 2024
2 parents aa24ba9 + f7ecf5b commit 74e91de
Show file tree
Hide file tree
Showing 44 changed files with 256 additions and 180 deletions.
8 changes: 4 additions & 4 deletions cl/assets/templates/includes/pagination.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@
<div class="col-xs-3">
{% if page_obj.has_previous %}
{% if not hide_first %}
<a href="?{{ get_string }}page=1"
<a href="{% querystring page=1 %}"
rel="first" class="hidden-xs btn btn-default" >
<i class="fa fa-caret-left no-underline" ></i>
<i class="fa fa-caret-left no-underline" ></i>
<span class="">First</span>
</a>
{% endif %}
<a href="?{{ get_string }}page={{ page_obj.previous_page_number }}"
<a href="{% querystring page=page_obj.previous_page_number %}"
rel="prev"
class="btn btn-default" >
<i class="fa fa-caret-left no-underline" ></i>
Expand All @@ -25,14 +25,14 @@
</div>
<div class="col-xs-3 text-right" >
{% if page_obj.has_next %}
<a href="?{{ get_string }}page={{ page_obj.next_page_number }}"
<a href="{% querystring page=page_obj.next_page_number %}"
rel="next"
class="btn btn-default" >
<span class="hidden-xs">Next</span>
<i class="fa fa-caret-right no-underline" ></i>
</a>
{% if not hide_last %}
<a href="?{{ get_string }}page={{ page_obj.paginator.num_pages }}"
<a href="{% querystring page=page_obj.paginator.num_pages %}"
rel="last" class="hidden-xs btn btn-default" >
<span class="">Last</span>
<i class="fa fa-caret-right no-underline" ></i>
Expand Down
15 changes: 15 additions & 0 deletions cl/custom_filters/templatetags/extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,3 +285,18 @@ def format_date(date_str: str) -> str:
return date_obj.strftime("%B %dth, %Y")
except (ValueError, TypeError):
return date_str


@register.filter
def build_docket_id_q_param(request_q: str, docket_id: str) -> str:
"""Build a query string that includes the docket ID and any existing query
parameters.
:param request_q: The current query string, if present.
:param docket_id: The docket_id to append to the query string.
:return:The query string with the docket_id included.
"""

if request_q:
return f"({request_q}) AND docket_id:{docket_id}"
return f"docket_id:{docket_id}"
10 changes: 8 additions & 2 deletions cl/favorites/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,9 @@ class Migration(migrations.Migration):
],
options={
'unique_together': {('user', 'name')},
'index_together': {('user', 'name')},
'indexes': [
models.Index(fields=['user', 'name'], name='favorites_usertag_user_id_name_54aef6fe_idx'),
],
},
),
migrations.AddField(
Expand All @@ -58,7 +60,11 @@ class Migration(migrations.Migration):
('user', models.ForeignKey(help_text='The user that made the prayer', on_delete=django.db.models.deletion.CASCADE, related_name='prayers', to=settings.AUTH_USER_MODEL)),
],
options={
'index_together': {('recap_document', 'user'), ('recap_document', 'status'), ('date_created', 'user', 'status')},
'indexes': [
models.Index(fields=['recap_document', 'user'], name='favorites_prayer_recap_document_id_user_id_c5d30108_idx'),
models.Index(fields=['recap_document', 'status'], name='favorites_prayer_recap_document_id_status_82e2dbbb_idx'),
models.Index(fields=['date_created', 'user', 'status'], name='favorites_prayer_date_created_user_id_status_880d7280_idx'),
],
},
),
migrations.CreateModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ class Migration(migrations.Migration):
operations = [
migrations.RenameIndex(
model_name="prayer",
new_name="favorites_p_recap_d_00e8c5_idx",
new_name="favorites_prayer_recap_document_id_status_82e2dbbb_idx",
old_fields=("recap_document", "status"),
),
migrations.RenameIndex(
model_name="prayer",
new_name="favorites_p_date_cr_8bf054_idx",
new_name="favorites_prayer_date_created_user_id_status_880d7280_idx",
old_fields=("date_created", "user", "status"),
),
migrations.RenameIndex(
model_name="prayer",
new_name="favorites_p_recap_d_7c046c_idx",
new_name="favorites_prayer_recap_document_id_user_id_c5d30108_idx",
old_fields=("recap_document", "user"),
),
migrations.RenameIndex(
model_name="usertag",
new_name="favorites_u_user_id_f6c9a6_idx",
new_name="favorites_usertag_user_id_name_54aef6fe_idx",
old_fields=("user", "name"),
),
]
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
BEGIN;
--
-- Rename unnamed index for ('recap_document', 'status') on prayer to favorites_p_recap_d_00e8c5_idx
-- Rename unnamed index for ('recap_document', 'status') on prayer to favorites_prayer_recap_document_id_status_82e2dbbb_idx
--
ALTER INDEX "favorites_prayer_recap_document_id_status_82e2dbbb_idx" RENAME TO "favorites_p_recap_d_00e8c5_idx";
-- (no-op)
--
-- Rename unnamed index for ('date_created', 'user', 'status') on prayer to favorites_p_date_cr_8bf054_idx
-- Rename unnamed index for ('date_created', 'user', 'status') on prayer to favorites_prayer_date_created_user_id_status_880d7280_idx
--
ALTER INDEX "favorites_prayer_date_created_user_id_status_880d7280_idx" RENAME TO "favorites_p_date_cr_8bf054_idx";
-- (no-op)
--
-- Rename unnamed index for ('recap_document', 'user') on prayer to favorites_p_recap_d_7c046c_idx
-- Rename unnamed index for ('recap_document', 'user') on prayer to favorites_prayer_recap_document_id_user_id_c5d30108_idx
--
ALTER INDEX "favorites_prayer_recap_document_id_user_id_c5d30108_idx" RENAME TO "favorites_p_recap_d_7c046c_idx";
-- (no-op)
--
-- Rename unnamed index for ('user', 'name') on usertag to favorites_u_user_id_f6c9a6_idx
-- Rename unnamed index for ('user', 'name') on usertag to favorites_usertag_user_id_name_54aef6fe_idx
--
ALTER INDEX "favorites_usertag_user_id_name_54aef6fe_idx" RENAME TO "favorites_u_user_id_f6c9a6_idx";
-- (no-op)
COMMIT;
22 changes: 18 additions & 4 deletions cl/favorites/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,12 @@ def __str__(self) -> str:

class Meta:
unique_together = (("user", "name"),)
indexes = [models.Index(fields=["user", "name"])]
indexes = [
models.Index(
fields=["user", "name"],
name="favorites_usertag_user_id_name_54aef6fe_idx",
)
]


@pghistory.track(AfterUpdateOrDeleteSnapshot())
Expand Down Expand Up @@ -167,11 +172,20 @@ class Meta:
# prayers do we have for this document?
# When loading the prayer leader board, we'll ask: Which documents
# have the most outstanding prayers?
models.Index(fields=["recap_document", "status"]),
models.Index(
fields=["recap_document", "status"],
name="favorites_prayer_recap_document_id_status_82e2dbbb_idx",
),
# When loading docket pages, we'll ask (hundreds of times): Did
# user ABC pray for document XYZ?
models.Index(fields=["recap_document", "user"]),
models.Index(
fields=["recap_document", "user"],
name="favorites_prayer_recap_document_id_user_id_c5d30108_idx",
),
# When a user votes, we'll ask: How many outstanding prayers did
# user ABC make today?
models.Index(fields=["date_created", "user", "status"]),
models.Index(
fields=["date_created", "user", "status"],
name="favorites_prayer_date_created_user_id_status_880d7280_idx",
),
]
4 changes: 0 additions & 4 deletions cl/favorites/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,7 @@ async def get_note(request: HttpRequest) -> HttpResponse:
return note


@sync_to_async
@login_required
@async_to_sync
async def save_or_update_note(request: HttpRequest) -> HttpResponse:
"""Uses ajax to save or update a note.
Expand Down Expand Up @@ -92,9 +90,7 @@ async def save_or_update_note(request: HttpRequest) -> HttpResponse:
)


@sync_to_async
@login_required
@async_to_sync
async def delete_note(request: HttpRequest) -> HttpResponse:
"""Delete a user's note
Expand Down
4 changes: 3 additions & 1 deletion cl/lasc/migrations/0001_initial.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ class Migration(migrations.Migration):
('status_str', models.TextField(blank=True, help_text='The status of the case')),
],
options={
'index_together': {('docket_number', 'district', 'division_code')},
'indexes': [
models.Index(fields=['docket_number', 'district', 'division_code'], name='lasc_docket_docket_number_district_division_code_07584433_idx'),
],
},
),
migrations.CreateModel(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Migration(migrations.Migration):
operations = [
migrations.RenameIndex(
model_name="docket",
new_name="lasc_docket_docket__4b4f04_idx",
new_name="lasc_docket_docket_number_district_division_code_07584433_idx",
old_fields=("docket_number", "district", "division_code"),
),
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BEGIN;
--
-- Rename unnamed index for ('docket_number', 'district', 'division_code') on docket to lasc_docket_docket__4b4f04_idx
-- Rename unnamed index for ('docket_number', 'district', 'division_code') on docket to lasc_docket_docket_number_district_division_code_07584433_idx
--
ALTER INDEX "lasc_docket_docket_number_district_division_code_07584433_idx" RENAME TO "lasc_docket_docket__4b4f04_idx";
-- (no-op)
COMMIT;
5 changes: 4 additions & 1 deletion cl/lasc/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,10 @@ class Docket(AbstractDateTimeModel):

class Meta:
indexes = [
models.Index(fields=["docket_number", "district", "division_code"])
models.Index(
fields=["docket_number", "district", "division_code"],
name="lasc_docket_docket_number_district_division_code_07584433_idx",
)
]

@property
Expand Down
2 changes: 1 addition & 1 deletion cl/opinion_page/templates/docket_tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ <h3>Oral Argument Recordings</h3>
<ul>
{% for af in docket.audio_files.all %}
<li>
<a href="{{ af.get_absolute_url }}?{{ request.META.QUERY_STRING }}">
<a href="{{ af.get_absolute_url }}{% querystring %}">
{{ af|best_case_name|safe|v_wrapper }}
</a>
{% if perms.audio.change_audio %}
Expand Down
2 changes: 1 addition & 1 deletion cl/opinion_page/templates/includes/authorities_list.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% for authority in authorities %}
<li>
{{ authority.depth }} reference{{ authority.depth|pluralize }} to
<a href="{{ authority.cited_opinion.cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}" {% if authority.blocked %}rel="nofollow" {% endif %}>
<a href="{{ authority.cited_opinion.cluster.get_absolute_url }}{% querystring %}" {% if authority.blocked %}rel="nofollow" {% endif %}>
{{ authority.cited_opinion.cluster.caption|safe|v_wrapper }}
</a>
<br />
Expand Down
4 changes: 2 additions & 2 deletions cl/opinion_page/templates/includes/de_filter.html
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
<div class="tight-input col-xs-6 hidden-sm col-sm-6 col-md-1 col-lg-2" >
<div class="pull-right" >
{% if docket_entries.has_previous %}
<a class="btn btn-default" href="?{{ get_string }}page={{ docket_entries.previous_page_number }}" rel="prev" >
<a class="btn btn-default" href="{% querystring page=docket_entries.previous_page_number %}" rel="prev" >
<i class="fa fa-caret-left" ></i><span class="hidden-md" >&nbsp;Prev.</span>
</a>
{% else %}
Expand All @@ -94,7 +94,7 @@
</a>
{% endif %}
{% if docket_entries.has_next %}
<a class="btn btn-default" href="?{{ get_string }}page={{ docket_entries.next_page_number }}" rel="next" >
<a class="btn btn-default" href="{% querystring page=docket_entries.next_page_number %}" rel="next" >
<span class="hidden-md" >Next&nbsp;</span><i class="fa fa-caret-right"></i>
</a>
{% else %}
Expand Down
4 changes: 2 additions & 2 deletions cl/opinion_page/templates/includes/opinions_sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{% flag "o-es-active" %}
{% for opinion in opinions.object_list %}
<li>
<a href="{{ opinion.absolute_url }}?{{ request.META.QUERY_STRING }}">
<a href="{{ opinion.absolute_url }}{% querystring %}">
{% with opinion.title as title %}
{{ opinion.caseName|default:title|default_if_none:"N/A"|safe|truncatewords:10|v_wrapper }}
{% endwith %}
Expand All @@ -14,7 +14,7 @@
{% else %}
{% for opinion in opinions %}
<li>
<a href="{{ opinion.absolute_url }}?{{ request.META.QUERY_STRING }}">
<a href="{{ opinion.absolute_url }}{% querystring %}">
{% with opinion.title as title %}
{{ opinion.caseName|default:title|default_if_none:"N/A"|safe|truncatewords:10|v_wrapper }}
{% endwith %}
Expand Down
4 changes: 2 additions & 2 deletions cl/opinion_page/templates/opinion.html
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ <h3><span>Summaries ({{ summaries_count|intcomma }})</span></h3>
{% endfor %}
</ul>
<h4>
<a href="{% url "view_summaries" pk=cluster.pk slug=cluster.slug %}?{{ request.META.QUERY_STRING }}"
<a href="{% url "view_summaries" pk=cluster.pk slug=cluster.slug %}{% querystring %}"
class="btn btn-default">
View All Summaries
</a>
Expand All @@ -123,7 +123,7 @@ <h3>
<ul>
{% for citing_cluster in citing_clusters %}
<li>
<a href="{{ citing_cluster.absolute_url }}?{{ request.META.QUERY_STRING }}">{{ citing_cluster.caseName|safe|truncatewords:12|v_wrapper }} ({{ citing_cluster.dateFiled|date:"Y" }})</a>
<a href="{{ citing_cluster.absolute_url }}{% querystring %}">{{ citing_cluster.caseName|safe|truncatewords:12|v_wrapper }} ({{ citing_cluster.dateFiled|date:"Y" }})</a>
</li>
{% endfor %}
</ul>
Expand Down
6 changes: 3 additions & 3 deletions cl/opinion_page/templates/opinion_authorities.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<div class="sidebar-section">
<h4 class="bottom">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{{ cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}"
<a href="{{ cluster.get_absolute_url }}{% querystring %}"
{% if cluster.blocked %}rel="nofollow"{% endif %}>Back to Opinion</a>
</h4>
</div>
Expand All @@ -28,7 +28,7 @@ <h4 class="bottom">
{% block content %}
<div class="col-sm-9">
<h2>
<a href="{{ cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}"
<a href="{{ cluster.get_absolute_url }}{% querystring %}"
class="black-link no-underline"
{% if cluster.blocked %}rel="nofollow"{% endif %}>{{ caption|safe|v_wrapper }}</a>
</h2>
Expand All @@ -41,7 +41,7 @@ <h3>This opinion cites {{ authorities_with_data|length|intcomma }} opinion{{ aut
{% for authority in authorities_with_data %}
<li>
{{ authority.citation_depth }} reference{{ authority.citation_depth|pluralize }} to
<a href="{{ authority.get_absolute_url }}?{{ request.META.QUERY_STRING }}"
<a href="{{ authority.get_absolute_url }}{% querystring %}"
{% if authority.blocked %}rel="nofollow"{% endif %}>
{{ authority.caption|safe|v_wrapper }}
</a>
Expand Down
8 changes: 4 additions & 4 deletions cl/opinion_page/templates/opinion_summaries.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="sidebar-section">
<h4 class="bottom">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{{ cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}"
<a href="{{ cluster.get_absolute_url }}{% querystring %}"
{% if cluster.blocked %}rel="nofollow"{% endif %}>Back to Opinion</a>
</h4>
</div>
Expand All @@ -29,7 +29,7 @@ <h4 class="bottom">
{% block content %}
<div class="col-sm-9">
<h2>
<a href="{{ cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}"
<a href="{{ cluster.get_absolute_url }}{% querystring %}"
class="black-link no-underline"
{% if cluster.blocked %}rel="nofollow"{% endif %}>{{ caption|safe|v_wrapper }}</a>
</h2>
Expand All @@ -53,7 +53,7 @@ <h3>{{ summaries_count|intcomma }} judge-written summar{{ summaries_count|plural
<div class="summary-group-metadata">
<span class="bullet-tail">{{ representative_cluster.date_filed }}</span>
<span class="bullet-tail">
<a href="{{ representative_cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}">
<a href="{{ representative_cluster.get_absolute_url }}{% querystring %}">
{{ representative_cluster|best_case_name|safe }}
</a>
</span>
Expand All @@ -78,7 +78,7 @@ <h3>{{ summaries_count|intcomma }} judge-written summar{{ summaries_count|plural
<br/>
<span class="bullet-tail">{{ describing_cluster.date_filed }}</span>
<span class="bullet-tail">
<a href="{{ describing_cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}">
<a href="{{ describing_cluster.get_absolute_url }}{% querystring %}">
{{ describing_cluster|best_case_name|safe }}
</a>
</span>
Expand Down
2 changes: 1 addition & 1 deletion cl/opinion_page/templates/opinion_visualizations.html
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<div class="sidebar-section">
<h4 class="bottom">
<i class="fa fa-arrow-circle-o-left gray"></i>
<a href="{{ cluster.get_absolute_url }}?{{ request.META.QUERY_STRING }}">Back
<a href="{{ cluster.get_absolute_url }}{% querystring %}">Back
to Opinion</a>
</h4>
</div>
Expand Down
2 changes: 0 additions & 2 deletions cl/opinion_page/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,6 @@ async def court_homepage(request: HttpRequest, pk: str) -> HttpResponse:
return TemplateResponse(request, template, render_dict)


@sync_to_async
@group_required(
"tenn_work_uploaders",
"uploaders_tennworkcompcl",
Expand All @@ -197,7 +196,6 @@ async def court_homepage(request: HttpRequest, pk: str) -> HttpResponse:
"uploaders_miss",
"uploaders_missctapp",
)
@async_to_sync
async def court_publish_page(request: HttpRequest, pk: str) -> HttpResponse:
"""Display upload form and intake Opinions for partner courts
Expand Down
2 changes: 1 addition & 1 deletion cl/recap/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class Meta:

pacer_case_id = Faker("pyint", min_value=100_000, max_value=400_000)
upload_type = FuzzyChoice(UPLOAD_TYPE.NAMES, getter=lambda c: c[0])
filepath_local = FileField(filename=None)
filepath_local = FileField(filename="document.html")


class PacerFetchQueueFactory(DjangoModelFactory):
Expand Down
Loading

0 comments on commit 74e91de

Please sign in to comment.