Project_Camper/vagus/reservation/views.py

22 lines
759 B
Python
Raw Normal View History

2021-01-17 17:10:04 +01:00
from django.shortcuts import render,get_object_or_404
from django.utils.decorators import method_decorator
from django.contrib.auth.decorators import login_required
from .forms import ReservationForm
from camper.models import Offer, Image_offer
from django.views.generic import (
DetailView
)
class DetailOfferPage(DetailView):
model = Offer
template_name = 'offer/offer-detail.html'
def get_context_data(self, **kwargs):
context = super(DetailOfferPage, self).get_context_data(**kwargs)
context['form'] = ReservationForm
context['Image_offer'] = Image_offer.objects.filter(offer = self.object)
return context
@method_decorator(login_required)
def post(self,request,*args,**kwargs):
pass