Django 引荐来源问题

发布于 2024-12-03 13:13:33 字数 807 浏览 1 评论 0原文

我想知道谁引用了我的网页,因此在我的模型中我有:

referrer = models.CharField(max_length=30, default='google',
        verbose_name=_('referrer'), help_text=_('Referrer'))
This are the URL's for my page:
url(r'^$', app_views.index, name='index_default')
and
url(r'^(\w+)/$', app_views.index, name='index_default2')
I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:
< param name="FlashVars" value="referrer={{ referrer }}" />
How should the view look like in order to catch the referrer matched with the regular expression? Something like
def index(request):
    return render_to_response('index.html',
            {
            'referrer':referrer,
            },
            context_instance=RequestContext(request))

I want to know who refers my webpage, so in my models I have:

referrer = models.CharField(max_length=30, default='google',
        verbose_name=_('referrer'), help_text=_('Referrer'))

This are the URL's for my page:

url(r'^

and

url(r'^(\w+)/

I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:

< param name="FlashVars" value="referrer={{ referrer }}" />

How should the view look like in order to catch the referrer matched with the regular expression? Something like

def index(request):
    return render_to_response('index.html',
            {
            'referrer':referrer,
            },
            context_instance=RequestContext(request))

, app_views.index, name='index_default')

and


I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:


How should the view look like in order to catch the referrer matched with the regular expression? Something like


, app_views.index, name='index_default2')

I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:

How should the view look like in order to catch the referrer matched with the regular expression? Something like

, app_views.index, name='index_default')

and

I want to send my referrer parameter to the flash embeddeded within my HTML along flashvars:

How should the view look like in order to catch the referrer matched with the regular expression? Something like

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

清眉祭 2024-12-10 13:13:33

在请求的元字典中有一个 HTTP_REFERER 值..我认为这可以帮助你

in the meta dictionary of request there is a HTTP_REFERER value .. I think that can help you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文