سؤال

I have a link

 a href="editYou/{{costumer.slug}}"

and URL parttern

(r'editYou/<?P(costumerSlug>.*)/$', 'editYou'),

that points to method

def editYou(request, costumerSlug):

but Django shows an error:

The current URL, profile/editYou/es, didn't match any of these.

How you help me to find what is the reason?

هل كانت مفيدة؟

المحلول

Your pattern is wrong, it should be

r'editYou/(?P<costumerSlug>.*)/$'
#         ^^^^
#   not   <?P(costumerSlug>.*)

نصائح أخرى

It may be better to name your urls like:

(r'editYou/(?P<costumerSlug>.*)/$', 'editYou', name="edit"),

Then in your templates, you could use:

 a href="{% url edit costumer.slug %}"
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top