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

Popular posts from this blog

javascript - Count length of each class -

What design pattern is this code in Javascript? -

hadoop - Restrict secondarynamenode to be installed and run on any other node in the cluster -