self.object = get_object_or_404(Offer, **args)
return super(OfferDetailView, self).dispatch(request, slug)
self.object = get_object_or_404(Offer, **args)
return super(OfferDetailView, self).dispatch(request, slug)
def get_context_data(self, *args, **kwargs):
ctx = super(OfferDetailView, self).get_context_data(*args, **kwargs)
ctx['entry'] = self.object.entry
return ctx
def get_form(self, form_class):
def get_context_data(self, *args, **kwargs):
ctx = super(OfferDetailView, self).get_context_data(*args, **kwargs)
ctx['entry'] = self.object.entry
return ctx
def get_form(self, form_class):
- if self.request.method == 'POST':
- return form_class(self.object, self.request.POST)
- else:
- return form_class(self.object)
+ return form_class(self.object, self.request.POST)