Thursday, September 25, 2014

1 named url per page/screen?

1. I am trying to understand the documentation here: https://docs.djangoproject.com/en/1.7/topics/http/urls/#naming-url-patterns

Let us suppose I have a model and folder on mysite called Colors. Within Colors there are several individual documents: blue, green, yellow.

If blue, green, and yellow all use the same view and template, [and they're supposed to, aren't they?]  does this mean each url must be named 'blue' or 'green' or 'yellow' in order for Django to tell them apart?

That's how I'm reading this, but that doesn't make sense to me, because it seems to be about the same as hardcoding the url, and if you have a lot of pages it would be murder to have to do this for every page, and seems contrary to the whole notion of a dynamic web site.  So what am I missing here?



2. I am struggling with this error: 

" Reverse for 'colors_articleView' with arguments '()' and keyword arguments '{u'pk': '', u'slug': ''}' not found. 1 pattern(s) tried: ['colors/(?P<pk>\\d+)/(?P<slug>[\\w]+)'] "

I don't know what I'm missing here. I did a queryset for all the colors in a function based equivalent to list view and didn't see this error, but now that I want individual pages I can't resolve it. 



thx.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/c41e2fc7-fb04-4c1f-b269-f9849ded1139%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment