First Commit

This commit is contained in:
mrtoine 2025-09-12 11:11:44 +02:00
commit ce0758fbbb
496 changed files with 52062 additions and 0 deletions

0
home/__init__.py Executable file
View file

3
home/admin.py Executable file
View file

@ -0,0 +1,3 @@
from django.contrib import admin
# Register your models here.

6
home/apps.py Executable file
View file

@ -0,0 +1,6 @@
from django.apps import AppConfig
class HomeConfig(AppConfig):
default_auto_field = "django.db.models.BigAutoField"
name = "home"

0
home/migrations/__init__.py Executable file
View file

3
home/models.py Executable file
View file

@ -0,0 +1,3 @@
from django.db import models
# Create your models here.

3
home/tests.py Executable file
View file

@ -0,0 +1,3 @@
from django.test import TestCase
# Create your tests here.

12
home/urls.py Executable file
View file

@ -0,0 +1,12 @@
from django.urls import path
from django.conf.urls.static import static
from passion_retro import settings
from . import views
urlpatterns = [
path("", views.home, name="home"),
]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

16
home/views.py Executable file
View file

@ -0,0 +1,16 @@
from django.shortcuts import render
from posts.models import Post
def home(request):
edito = Post.objects.filter(type='edito', active=True).first()
news = Post.objects.filter(type='news', active=True).order_by('-created')[:6]
context = {
'edito': edito,
'news': news,
}
return render(request, "home.html", context)
def custom_404(request, exception):
return render(request, "errors/404.html", status=404)