From 76be203804cb843a2b0c223a5d20ea4760eca19f Mon Sep 17 00:00:00 2001 From: yann Date: Wed, 23 Apr 2025 15:00:35 +0200 Subject: [PATCH] register page ok: working on reviews.models --- LITReview/LITReview/settings.py | 3 +++ LITReview/LITReview/urls.py | 7 +++++++ .../templates/authentication/register.html | 14 +++++++++----- LITReview/reviews/models.py | 2 +- 4 files changed, 20 insertions(+), 6 deletions(-) diff --git a/LITReview/LITReview/settings.py b/LITReview/LITReview/settings.py index cbdeeda..7221e49 100644 --- a/LITReview/LITReview/settings.py +++ b/LITReview/LITReview/settings.py @@ -133,6 +133,9 @@ LOGOUT_REDIRECT_URL = 'login' AUTH_USER_MODEL = 'authentication.User' +MEDIA_URL = 'media/' + +MEDIA_ROOT = BASE_DIR.joinpath(MEDIA_URL) diff --git a/LITReview/LITReview/urls.py b/LITReview/LITReview/urls.py index 5e99172..f6b576a 100644 --- a/LITReview/LITReview/urls.py +++ b/LITReview/LITReview/urls.py @@ -16,6 +16,8 @@ Including another URLconf """ from django.contrib import admin from django.urls import path +from django.conf import settings +from django.conf.urls.static import static from django.contrib.auth.views import LoginView, LogoutView, PasswordChangeView, PasswordChangeDoneView import authentication.views, reviews.views @@ -37,3 +39,8 @@ urlpatterns = [ path('posts/', reviews.views.posts, name='posts'), path('subscribed/', reviews.views.subscribed, name='subscribed'), ] + +if settings.DEBUG: + urlpatterns += static( + settings.MEDIA_URL, document_root=settings.MEDIA_ROOT + ) diff --git a/LITReview/authentication/templates/authentication/register.html b/LITReview/authentication/templates/authentication/register.html index d6e909e..8cbd480 100644 --- a/LITReview/authentication/templates/authentication/register.html +++ b/LITReview/authentication/templates/authentication/register.html @@ -1,21 +1,25 @@ {% extends 'base.html' %} {% block content %}
-
+

Inscrivez-vous

-
- Retourner -
-
+
{% csrf_token %} {{ form.as_p }} +
+
+
+
+ Retourner +
+
diff --git a/LITReview/reviews/models.py b/LITReview/reviews/models.py index c6130aa..a9f5574 100644 --- a/LITReview/reviews/models.py +++ b/LITReview/reviews/models.py @@ -14,7 +14,7 @@ class Ticket(models.Model): time_created = models.DateTimeField(auto_now_add=True) - + class Review(models.Model): ticket = models.ForeignKey(to=Ticket, on_delete=models.CASCADE) rating = models.PositiveSmallIntegerField(