我有一个页面drag.html
,在此网址上提供
http://localhost:8000/dashboard?wid=ca1480f&ref_url=localhost&adpart=left
此页面有一个链接
<a id="btn-start" href="/dashboard/save" class="btn">Save Reward</a>
当用户点击此链接时,它会重定向到SaveRewardview
我要保存链接中存在的所有信息,wid=ca1480f&ref_url=localhost&adpart=left
urls.py
url(r'^dashboard$', login_required(CouponPageView.as_view()), name='dashboard'),
url(r'^dashboard/save$', login_required(SaveRewardView.as_view()), name=''),
model.py
class SaveReward(models.Model):
widget = EmbeddedModelField(Widget)
campaign = EmbeddedModelField(Campaign)
coupon_part = models.CharField(max_length=200)
saved_on = models.DateTimeField(auto_now_add=True)
def __unicode__(self):
return self.widget.widget_name
Views.py
class SaveRewardView(TemplateView):
#Here how i will get wid , ref_url, adpart which is present in url parameters
答案 0 :(得分:2)
你可以直接在url中给出参数。
<a id="btn-start" href="/dashboard/?{{request.META.QUERY_STRING}}" class="btn">Save Reward</a>
网址是:
url(r'^dashboard/$', login_required(CouponPageView.as_view()), name='dashboard'),