django - HTML variable inside of String -
i'm building website django. want have string url [already done], want string changeable based on variables.
sudocode: variable = "hello"
url = "www.facebook.com/a" ----> want "a" changeable, if changes, url goes different website.
what best way this?
thanks
you should use saving groups in urls.py
:
from django.conf.urls import patterns, url urlpatterns = patterns('', url(r'^(?p<part>\w*)/$', 'my_app.views.my_view'), )
then, in my_view
view string appear keyword argument:
def my_view(request, part=none): print part
hope helps.
Comments
Post a Comment