Skip to content

Commit

Permalink
django-upgrade --target-version=5.0 **/*.py (#1939)
Browse files Browse the repository at this point in the history
* django-upgrade --target-version=5.0 **/*.py

* djLint: Use HTTPS for external links.
  • Loading branch information
cclauss committed Apr 30, 2024
1 parent 6264b53 commit 095a4a2
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 13 deletions.
8 changes: 8 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
exclude: ".*/vendor/.*"
repos:
- repo: https://github.com/adamchainz/django-upgrade
rev: 1.15.0
hooks:
- id: django-upgrade
args: [--target-version, "5.0"] # Replace with Django version

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.2
hooks:
Expand All @@ -10,10 +16,12 @@ repos:
rev: 5.13.2
hooks:
- id: isort

- repo: https://github.com/psf/black
rev: 24.4.2
hooks:
- id: black

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.6.0
hooks:
Expand Down
2 changes: 1 addition & 1 deletion docs/haystack_theme/layout.html
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{% extends "basic/layout.html" %}

{%- block extrahead %}
<link rel="stylesheet" href="http://haystacksearch.org/css/front.css" media="screen">
<link rel="stylesheet" href="https://haystacksearch.org/css/front.css" media="screen">
<link rel="stylesheet" href="_static/documentation.css" media="screen">
{% endblock %}

Expand Down
2 changes: 1 addition & 1 deletion example_project/regular_app/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def full_name(self):


class Toy(models.Model):
dog = models.ForeignKey(Dog, related_name="toys")
dog = models.ForeignKey(Dog, on_delete=models.CASCADE, related_name="toys")
name = models.CharField(max_length=60)

def __str__(self):
Expand Down
7 changes: 0 additions & 7 deletions haystack/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
from importlib.metadata import PackageNotFoundError, version

import django
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from packaging.version import Version
Expand All @@ -17,12 +16,6 @@
__version__ = "0.0.dev0"
version_info = Version(__version__)


if django.VERSION < (3, 2):
# default_app_config is deprecated since django 3.2.
default_app_config = "haystack.apps.HaystackConfig"


# Help people clean up from 1.X.
if hasattr(settings, "HAYSTACK_SITECONF"):
raise ImproperlyConfigured(
Expand Down
4 changes: 1 addition & 3 deletions test_haystack/core/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@
from .models import MockModel


@admin.register(MockModel)
class MockModelAdmin(SearchModelAdmin):
haystack_connection = "solr"
date_hierarchy = "pub_date"
list_display = ("author", "pub_date")


admin.site.register(MockModel, MockModelAdmin)
1 change: 0 additions & 1 deletion test_haystack/test_app_using_appconfig/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +0,0 @@
default_app_config = "test_app_using_appconfig.apps.SimpleTestAppConfig"

0 comments on commit 095a4a2

Please sign in to comment.