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

c# - SelectList with Dictionary, add values to the Dictionary after it's assigned to SelectList -

how can i manage url using .htaccess in php? -

ios - I get the error Property '...' not found on object of type '...' -