register page ok: working on reviews.models

This commit is contained in:
yann 2025-04-23 15:00:35 +02:00
parent f227705e28
commit 76be203804
4 changed files with 20 additions and 6 deletions

View File

@ -133,6 +133,9 @@ LOGOUT_REDIRECT_URL = 'login'
AUTH_USER_MODEL = 'authentication.User'
MEDIA_URL = 'media/'
MEDIA_ROOT = BASE_DIR.joinpath(MEDIA_URL)

View File

@ -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
)

View File

@ -1,21 +1,25 @@
{% extends 'base.html' %}
{% block content %}
<div class="container">
<div class="row justify-content-center mt-10">
<div class="row justify-content-center mt-5">
<div class="col text-center">
<h2>Inscrivez-vous</h2>
</div>
</div>
<div class="row justify-content-center">
<div class="col-3 d-flex align-items-end">
<a href="{% url 'login' %}" class="btn btn-primary">Retourner</a>
</div>
<div class="col-3 d-flex align-items-end">
<div class="col-6 justify-content-around d-flex align-items-end">
<form method='post'>
{% csrf_token %}
{{ form.as_p }}
<div class="row justify-content-end">
<div class="col-3 order-2">
<button type="submit" class="btn btn-primary">S'inscrire</button>
</form>
</div>
<div class="col-3 order-1">
<a href="{% url 'login' %}" class="btn btn-primary">Retourner</a>
</div>
</div>
</div>
</div>
</div>

View File

@ -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(