mirror of
https://github.com/rjNemo/villafleurie
synced 2026-06-06 02:16:47 +00:00
add views folder, put template and error views to their own files; update urls.py and html templates accordingly
This commit is contained in:
parent
2833cf0652
commit
19915c83a9
7 changed files with 57 additions and 55 deletions
|
|
@ -186,17 +186,19 @@
|
|||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'services' %}">Services</a>
|
||||
<a class="nav-link" href="{% url 'rental:services' %}"
|
||||
>Services</a
|
||||
>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'about' %}">À propos</a>
|
||||
<a class="nav-link" href="{% url 'rental:about' %}">À propos</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{% url 'contact' %}">Contact</a>
|
||||
<a class="nav-link" href="{% url 'rental:contact' %}">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<a class="btn btn-b" href="{% url 'reservation' %}">
|
||||
<a class="btn btn-b" href="{% url 'rental:reservation' %}">
|
||||
Réserver
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -250,14 +252,16 @@
|
|||
<ul class="list-unstyled">
|
||||
<li class="item-list-a">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
<a href="{% url 'legal' %}">Mentions légales</a>
|
||||
<a href="{% url 'rental:legal' %}">Mentions légales</a>
|
||||
</li>
|
||||
<li class="item-list-a">
|
||||
<i class="fa fa-angle-right"></i> <a href="#">Jobs</a>
|
||||
</li>
|
||||
<li class="item-list-a">
|
||||
<i class="fa fa-angle-right"></i>
|
||||
<a href="{% url 'partners' %}">Espace partenaires</a>
|
||||
<a href="{% url 'rental:partners' %}"
|
||||
>Espace partenaires</a
|
||||
>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
|
@ -280,13 +284,13 @@
|
|||
<a href="{% url 'rental:list_place' %}">Hébergements</a>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<a href="{% url 'reservation' %}">Réservation</a>
|
||||
<a href="{% url 'rental:reservation' %}">Réservation</a>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<a href="{% url 'about' %}">À propos</a>
|
||||
<a href="{% url 'rental:about' %}">À propos</a>
|
||||
</li>
|
||||
<li class="list-inline-item">
|
||||
<a href="{% url 'contact' %}">Contact</a>
|
||||
<a href="{% url 'rental:contact' %}">Contact</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@
|
|||
</p>
|
||||
</div>
|
||||
<div class="card-footer-c">
|
||||
<a href="{% url 'services' %}" class="link-c link-icon">En savoir plus
|
||||
<a href="{% url 'rental:services' %}" class="link-c link-icon">En savoir plus
|
||||
<span class="ion-ios-arrow-forward"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
@ -117,7 +117,7 @@
|
|||
</p>
|
||||
</div>
|
||||
<div class="card-footer-c">
|
||||
<a href="{% url 'services' %}" class="link-c link-icon">En savoir plus
|
||||
<a href="{% url 'rental:services' %}" class="link-c link-icon">En savoir plus
|
||||
<span class="ion-ios-arrow-forward"></span>
|
||||
</a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,21 +1,24 @@
|
|||
from django.urls import path
|
||||
from . import views
|
||||
from villafleurie import settings
|
||||
from rental.models.booking import Booking
|
||||
from rental.models.contact import Contact
|
||||
from rental.models.guest import Guest
|
||||
from rental.models.picture import Picture
|
||||
from rental.models.place import Place
|
||||
from rental.models.testimonial import Testimonial
|
||||
from django.contrib.staticfiles.urls import static, staticfiles_urlpatterns
|
||||
from django.urls import path
|
||||
from villafleurie import settings
|
||||
from rental.views import home, views
|
||||
|
||||
|
||||
app_name = 'rental'
|
||||
|
||||
urlpatterns = [
|
||||
path('a-propos/', home.About.as_view(), name='about'),
|
||||
path('legal/', home.Legal.as_view(), name='legal'),
|
||||
path('partenaires/', home.Partners.as_view(), name='partners'),
|
||||
path('services/', home.Services.as_view(), name='services'),
|
||||
|
||||
path('contact/', views.contact, name='contact'),
|
||||
path('reservation/', views.reservation, name='reservation'),
|
||||
|
||||
path('', views.index, name='index'),
|
||||
path('hebergements/', views.liste_location, name='list_place'),
|
||||
path('<place_name>/', views.location, name='detail_place'),
|
||||
path('calendar/<place_name>/', views.calendar, name='calendar')
|
||||
# path('calendar/<place_name>/', views.calendar, name='calendar'),
|
||||
]
|
||||
|
||||
urlpatterns += staticfiles_urlpatterns()
|
||||
|
|
|
|||
9
rental/views/errors.py
Normal file
9
rental/views/errors.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
from django.shortcuts import render
|
||||
|
||||
|
||||
def handler404(request, exception):
|
||||
return render(request, 'rental/404.html', status=404)
|
||||
|
||||
|
||||
def handler500(request):
|
||||
return render(request, 'rental/500.html', status=500)
|
||||
17
rental/views/home.py
Normal file
17
rental/views/home.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
from django.views.generic.base import TemplateView
|
||||
|
||||
|
||||
class Legal(TemplateView):
|
||||
template_name = 'rental/legal.html'
|
||||
|
||||
|
||||
class About(TemplateView):
|
||||
template_name = 'rental/about.html'
|
||||
|
||||
|
||||
class Partners(TemplateView):
|
||||
template_name = 'rental/partners.html'
|
||||
|
||||
|
||||
class Services(TemplateView):
|
||||
template_name = 'rental/service.html'
|
||||
|
|
@ -1,7 +1,6 @@
|
|||
from django.core.exceptions import ValidationError
|
||||
from django.db import IntegrityError
|
||||
from django.shortcuts import render, get_object_or_404
|
||||
from django.views.generic.base import TemplateView
|
||||
from django.utils.translation import gettext_lazy as _
|
||||
from rental.forms.booking import BookingForm
|
||||
from rental.forms.contact import ContactForm
|
||||
|
|
@ -152,26 +151,3 @@ def contact(request):
|
|||
context = {'form': form}
|
||||
return render(request, 'rental/contact.html', context)
|
||||
|
||||
|
||||
class Legal(TemplateView):
|
||||
template_name = 'rental/legal.html'
|
||||
|
||||
|
||||
class About(TemplateView):
|
||||
template_name = 'rental/about.html'
|
||||
|
||||
|
||||
class Partners(TemplateView):
|
||||
template_name = 'rental/partners.html'
|
||||
|
||||
|
||||
class Services(TemplateView):
|
||||
template_name = 'rental/service.html'
|
||||
|
||||
|
||||
def handler404(request, exception):
|
||||
return render(request, 'rental/404.html', status=404)
|
||||
|
||||
|
||||
def handler500(request):
|
||||
return render(request, 'rental/500.html', status=500)
|
||||
|
|
@ -2,19 +2,12 @@ from django.contrib import admin
|
|||
from django.urls import path
|
||||
from django.conf import settings
|
||||
from django.conf.urls import include, url
|
||||
from rental import views
|
||||
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('contact/', views.contact, name='contact'),
|
||||
path('a-propos/', views.About.as_view(), name='about'),
|
||||
path('reservation/', views.reservation, name='reservation'),
|
||||
path('legal/', views.Legal.as_view(), name='legal'),
|
||||
path('partenaires/', views.Partners.as_view(), name='partners'),
|
||||
path('services/', views.Services.as_view(), name='services'),
|
||||
path('', include('rental.urls', namespace='rental')),
|
||||
path('', include('rental.urls', namespace='rental'))
|
||||
]
|
||||
|
||||
handler404 = 'rental.views.handler404'
|
||||
handler500 = 'rental.views.handler500'
|
||||
handler500 = 'rental.views.errors.handler500'
|
||||
handler404 = 'rental.views.errors.handler404'
|
||||
|
|
|
|||
Loading…
Reference in a new issue