Skip to content

Commit 5970fe4

Browse files
committed
Merge branch 'miscs'
2 parents c7691ab + b9d8973 commit 5970fe4

File tree

7 files changed

+87
-81
lines changed

7 files changed

+87
-81
lines changed

.github/dependabot.yml

+2-4
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,9 @@ updates:
6161
interval: "weekly"
6262

6363
# Enable version updates for Python/Pip - Production
64-
- package-ecosystem: "pip"
65-
# Look for a `requirements.txt` in the `root` directory
66-
# also 'setup.cfg', 'runtime.txt' and 'requirements/*.txt'
64+
- package-ecosystem: "uv"
6765
directory: "/"
6866
open-pull-requests-limit: 15
6967
# Every weekday
7068
schedule:
71-
interval: "daily"
69+
interval: "weekly"

legadilo/reading/models/article.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import json
2020
import logging
2121
import math
22+
import re
2223
from collections.abc import Iterable
2324
from dataclasses import dataclass
2425
from itertools import chain
@@ -599,6 +600,7 @@ def create_invalid_article(
599600
user=user,
600601
link=article_link,
601602
title=full_sanitize(article_link),
603+
slug=slugify(re.sub(r"^https?://", "", article_link)),
602604
main_source_type=constants.ArticleSourceType.MANUAL,
603605
main_source_title=article_domain,
604606
)
@@ -834,8 +836,7 @@ def __str__(self):
834836
)
835837

836838
def save(self, *args, **kwargs):
837-
if not self.slug:
838-
self.slug = slugify(self.title)
839+
self.slug = self.slug or slugify(self.title) or str(_("no-slug"))
839840

840841
return super().save(*args, **kwargs)
841842

legadilo/reading/tests/test_models/test_article.py

+7
Original file line numberDiff line numberDiff line change
@@ -1342,12 +1342,19 @@ def test_create_invalid_article(self, user, django_assert_num_queries):
13421342
assert created
13431343
assert article.link == link
13441344
assert article.title == link
1345+
assert article.slug == "toto-com"
13451346
assert article.updated_at is None
13461347
assert article.main_source_type == constants.ArticleSourceType.MANUAL
13471348
assert article.main_source_title == "toto.com"
13481349
assert list(article.tags.all()) == [tag]
13491350
assert article.article_fetch_errors.count() == 1
13501351

1352+
def test_create_article_title_cannot_be_slugified(self, user):
1353+
article = Article.objects.create(link="https://toto.com/article", title="??", user=user)
1354+
1355+
assert article.title == "??"
1356+
assert article.slug == "no-slug"
1357+
13511358
def test_create_invalid_article_article_already_saved(self, user, django_assert_num_queries):
13521359
initial_article = ArticleFactory(user=user)
13531360
tag = TagFactory(user=user, title="Test")

legadilo/reading/tests/test_views/test_fetch_article_view.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,7 @@ def test_fetch_failure(self, logged_in_sync_client, httpx_mock):
157157
message="Failed to fetch the article. Please check that the URL you entered is "
158158
"correct, that the article exists and is accessible. "
159159
"We added its URL directly. "
160-
f'Go <a href="/reading/articles/{article.id}-https-www-example-com-posts-en-1-super-article/' # noqa: E501
160+
f'Go <a href="/reading/articles/{article.id}-www-example-com-posts-en-1-super-article/' # noqa: E501
161161
'">there</a> to access it.',
162162
)
163163
]
@@ -233,7 +233,7 @@ def test_content_too_big(self, logged_in_sync_client, httpx_mock, mocker):
233233
level=DEFAULT_LEVELS["WARNING"],
234234
message="The article you are trying to fetch is too big and cannot be processed. "
235235
"We added its URL directly. "
236-
f'Go <a href="/reading/articles/{article.id}-https-www-example-com-posts-en-1-super-article/"' # noqa: E501
236+
f'Go <a href="/reading/articles/{article.id}-www-example-com-posts-en-1-super-article/"' # noqa: E501
237237
">there</a> to access it.",
238238
)
239239
]

legadilo/users/admin.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ class UserAdmin(auth_admin.UserAdmin):
6464
),
6565
(_("Important dates"), {"fields": ("last_login", "date_joined")}),
6666
)
67-
list_display = ["email", "name", "is_superuser"]
67+
list_display = ["email", "date_joined", "last_login", "is_active", "is_superuser"]
6868
search_fields = ["name", "email_deterministic"]
69-
ordering = ["id"]
69+
ordering = ["last_login"]
7070
add_fieldsets = (
7171
(
7272
None,

pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ dev = [
6464
"pre-commit >= 4.0.1", # https://github.com/pre-commit/pre-commit
6565
# Django
6666
"factory-boy >= 3.3.1", # https://github.com/FactoryBoy/factory_boy
67-
"django-debug-toolbar >= 4.4.6", # https://github.com/jazzband/django-debug-toolbar
67+
"django-debug-toolbar >= 4.4.6, < 5.1.0", # https://github.com/jazzband/django-debug-toolbar
6868
"django-coverage-plugin >= 3.1.0", # https://github.com/nedbat/django_coverage_plugin
6969
"pytest-django >= 4.9.0", # https://github.com/pytest-dev/pytest-django
7070
"django-browser-reload >= 1.17.0", # https://pypi.org/project/django-browser-reload/

0 commit comments

Comments
 (0)