Python/Django: as_view() takes 1 positional argument but 2 were given -
i have written as_view() in django project in 2 positional arguments given submit form. when rendering template raising type error : as_view() takes 1 positional argument 2 given. appreciate helping me in solve this.
views.py:
class auctionview(loginrequiredmixin, multipleformsview): template_name = 'loggedin_load/active_deals.html' form_classes = {'accept_bid': auctionform, 'accepted': acceptedform} success_url = '/live_bids/' @method_decorator(user_passes_test(not_in_company_group, login_url='/login/')) def dispatch(self, *args, **kwargs): return super(auctionview, self).dispatch(*args, **kwargs) def accept_bid_form_valid(self, request, post_id, bid_id, form): accept_bid = form.save(commit=false) accept_bid.bid = bid accept_bid.post = post accept_bid.post_owner = request.user accept_bid.save() form.save() return form.accept_bid(self.request, redirect_url=self.get_success_url()) def accepted_form_valid(self, form): accepted = form1.save(commit=false) return form.accepted(self.request, user, self.get_success_url())
urls.py:
url(r'^post/(?p<post_id>[\w-]+)/bid/(?p<bid_id>[\w-]+)/$', auctionview.as_view, name='accept_bid'),
url(r'^post/(?p<post_id>[\w-]+)/bid/(?p<bid_id>[\w-]+)/$', auctionview.as_view(), name='accept_bid'),
Comments
Post a Comment