31 lines
815 B
Python
31 lines
815 B
Python
from django.shortcuts import render,redirect, get_object_or_404
|
|
from django.views.generic import (
|
|
ListView,
|
|
DetailView,
|
|
View
|
|
)
|
|
from camper.models import Offer, Image_offer
|
|
from django.http import Http404, HttpResponseRedirect
|
|
class Home(View):
|
|
|
|
def get(self, request, *args, **kwargs):
|
|
return render(request, 'index.html')
|
|
|
|
|
|
class OfferDetailView(DetailView):
|
|
template_name = 'offer/offer-detail.html'
|
|
model = Offer
|
|
|
|
|
|
#def get_context_data(self, **kwargs):
|
|
#context = super(OfferDetailView,self).get_context_data(**kwargs)
|
|
#context["images"] = self.queryset
|
|
#return context
|
|
|
|
|
|
class OfferListView(ListView):
|
|
model = Offer
|
|
template_name = 'offer/offers.html'
|
|
|
|
def get_queryset(self):
|
|
return Offer.objects.filter(status = 'Active') |