chore: fix pre-commit hook

This commit is contained in:
2026-09-10 13:58:49 +02:00
parent 3944c971eb
commit cce932d171
15 changed files with 139 additions and 44 deletions
-3
View File
@@ -8,9 +8,6 @@ devenv.local.yaml
# direnv
.direnv
# pre-commit
.pre-commit-config.yaml
*.sqlite3
*.pyc
+15
View File
@@ -0,0 +1,15 @@
repos:
- repo: https://github.com/djlint/djLint
rev: v1.46.1
hooks:
- id: djlint-reformat-django
language: system
- id: djlint-django
language: system
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.16.6
hooks:
- id: ruff-check
language: system
- id: ruff-format
language: system
-14
View File
@@ -13,18 +13,4 @@
};
};
git-hooks.hooks = {
ruff = {
enable = true;
package = pkgs.ruff;
excludes = [ "migrations/" ];
};
djlint = {
enable = true;
name = "djlint";
entry = "djlint --check .";
types = [ "html" ];
};
};
}
+3 -2
View File
@@ -18,13 +18,14 @@ Including another URLconf
from django.conf import settings
from django.conf.urls.static import static
from django.contrib import admin
from django.urls import path
from django.urls import include, path
from portfolio.views import IndexView
from patrickcanal_it.views import IndexView
urlpatterns = [
path("admin/", admin.site.urls),
path("", IndexView.as_view(), name="index"),
path("portfolio/", include("portfolio.urls")),
]
if settings.DEBUG:
+7
View File
@@ -0,0 +1,7 @@
from django.shortcuts import redirect
from django.views.generic import View
class IndexView(View):
def get(self, request, *args, **kwargs):
return redirect("portfolio")
+7
View File
@@ -7,10 +7,17 @@ from portfolio import models
class JobExperienceAdmin(admin.ModelAdmin):
pass
@admin.register(models.JobTask)
class JobTaskAdmin(admin.ModelAdmin):
pass
@admin.register(models.Company)
class CompanyAdmin(admin.ModelAdmin):
pass
@admin.register(models.Project)
class ProjectAdmin(admin.ModelAdmin):
list_display = ["name", "short_description"]
@@ -0,0 +1,28 @@
# Generated by Django 6.1 on 2026-08-30 18:10
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('portfolio', '0002_alter_company_options_jobexperience_position'),
]
operations = [
migrations.CreateModel(
name='Project',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('name', models.CharField(max_length=256, verbose_name='Name')),
('short_description', models.CharField(max_length=512, verbose_name='Short description')),
('url', models.URLField(blank=True, verbose_name='URL')),
],
),
migrations.AlterField(
model_name='jobtask',
name='job',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='job_tasks', to='portfolio.jobexperience'),
),
]
+15 -1
View File
@@ -38,9 +38,23 @@ class JobExperience(models.Model):
class JobTask(models.Model):
job = models.ForeignKey(
to=JobExperience, null=False, blank=False, on_delete=models.CASCADE, related_name="job_tasks"
to=JobExperience,
null=False,
blank=False,
on_delete=models.CASCADE,
related_name="job_tasks",
)
description = models.TextField(verbose_name=_("Description"), max_length=4192)
def __str__(self):
return self.job.__str__()
class Project(models.Model):
name = models.CharField(
verbose_name=_("Name"), max_length=256, null=False, blank=False
)
short_description = models.CharField(
verbose_name=_("Short description"), max_length=512, blank=False, null=False
)
url = models.URLField(verbose_name=_("URL"), blank=True, null=False)
+3 -3
View File
@@ -29,7 +29,7 @@
</div>
</div>
<div class="text-center">
<a href="" class="btn btn-primary btn-lg me-2">My projects</a>
<a href="{% url 'projects' %}" class="btn btn-primary btn-lg me-2">My projects</a>
<a href="" class="btn btn-outline-secondary btn-lg">Contact me</a>
</div>
</div>
@@ -67,7 +67,7 @@
</div>
</div>
<div class="col">
<div class="card">
<div class="card h-full">
<div class="card-body d-flex align-items-center flex-column">
<div class="w-24 h-30 text-5xl pt-4">
<i class="fa-solid fa-server fa-2xl"></i>
@@ -96,7 +96,7 @@
<div class="card-body">
<p class="text-primary mb-0">{{ je.start }} - {% if je.end %}{{ je.end }}{% else %}{% trans "today" %}{% endif %}</p>
<h2 class="fs-2">{{ je.position }}</h2>
<div class="">
<div>
<div class="text-danger">{{ je.company.name }}</div>
<div class="text-secondary">{{ je.company.location }}</div>
<div class="mt-2 text-white">
+27
View File
@@ -0,0 +1,27 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<div class="container mt-4">
<div class="row row-deck row-cards">
{% for project in object_list %}
<div class="col-md-4">
{% if project.url %}
<a class="card card-link card-link-pop" href="{{ project.url }}">
<div class="card-body">
<h4>{{ project.name }}</h4>
<p>{{ project.short_description }}</p>
</div>
</a>
{% else %}
<div class="card">
<div class="card-body">
<h4>{{ project.name }}</h4>
<p>{{ project.short_description }}</p>
</div>
</div>
{% endif %}
</div>
{% endfor %}
</div>
</div>
{% endblock %}
+8
View File
@@ -0,0 +1,8 @@
from django.urls import path
from portfolio import views
urlpatterns = [
path("", views.PortfolioView.as_view(), name="portfolio"),
path("projects/", views.ProjectList.as_view(), name="projects"),
]
+10 -3
View File
@@ -1,10 +1,17 @@
from django.views.generic import TemplateView
from django.views.generic import ListView, TemplateView
from portfolio import models
class IndexView(TemplateView):
class PortfolioView(TemplateView):
template_name = "index.html"
def get_context_data(self, **kwargs):
return {"job_experiences": models.JobExperience.objects.all().order_by("-start")}
return {
"job_experiences": models.JobExperience.objects.all().order_by("-start")
}
class ProjectList(ListView):
template_name = "project_list.html"
model = models.Project
+3 -1
View File
@@ -19,4 +19,6 @@ line-ending = "auto"
[tool.ruff.lint]
extend-select = ["I"]
ignore = [
"RUF012"
]
+6 -6
View File
File diff suppressed because one or more lines are too long
+7 -11
View File
File diff suppressed because one or more lines are too long