This may or may not be the only issue, but it's not really reasonable
to have more than one url pattern with the same "name" ("link-prod").
This can't be "reverse()"ed to come up with one url path one time and
the other on other occasions, and who knows but that the generic views
url generation uses reverse().

Bill

On Thu, Jul 22, 2010 at 3:48 AM, maciekjbl <[email protected]> wrote:
> Hi,
>
> I wrote two apps in same project. There're quite similar, and this is
> the problem here. They have two idetical urls.py files :
>
> App 1 :
>
> from django.conf.urls.defaults import *
> from web_aplikacje.promocje.models import Promocja, Producent, Dodatek
>
> info = { 'queryset' : Producent.objects.all(),
>         'template_object_name': 'producent',
>         'extra_context': { 'dodatek' : Dodatek.objects.all }
> }
>
> urlpatterns = patterns('web_aplikacje.promocje.views',
>   url(r'^search/$', 'search', name="link-search"),
> )
>
> urlpatterns += patterns('django.views.generic.list_detail',
>    url(r'^(?P<slug>[-\w]+)/$', 'object_detail', info, name="link-
> prod"),
>    url(r'^$','object_list', info, name="link-home"),
>
> )
>
> App 2:
>
> from django.conf.urls.defaults import *
> from web_aplikacje.cenniki.models import Opis, Producent, Cennik
>
> info = { 'queryset' : Producent.objects.all(),
>         'template_object_name': 'producent',
>         'extra_context': { 'cennik' : Cennik.objects.all }
> }
>
> urlpatterns = patterns('web_aplikacje.cenniki.views',
>   url(r'^search/$', 'search', name="link-search"),
> )
>
> urlpatterns += patterns('django.views.generic.list_detail',
>    url(r'^(?P<slug>[-\w]+)/$', 'object_detail', info, name="link-
> prod"),
>    url(r'^$','object_list', info, name="link-home"),
>
> )
>
> My main urls.py in root catalog for project :
>
> from django.conf.urls.defaults import *
> from django.conf import settings
> from django.contrib import admin
>
> admin.autodiscover()
>
> urlpatterns = patterns('',
>    (r'^promocje/', include('web_aplikacje.promocje.urls')),
>    (r'^cenniki/', include('web_aplikacje.cenniki.urls')),
>    (r'^admin/', include(admin.site.urls)),
> )
>
> if settings.DEBUG:
>    urlpatterns += patterns('',
>    (r'^site_media/(?P<path>.*)$', 'django.views.static.serve',
>    {'document_root': '/home/virtual/web_aplikacje/img/'}),
> )
>
> Now every url which is generated by generic views have word 'cennik'.
> 'promocje' just gone from displaying in url's. I know this is because
> same generic view with slug in it, but I don't have idea how to
> separate them. I would like to have access to data in this form:
>
> http://some_site_name/promocje/producent-1/
> http://some_site_name/promocje/producent-2/
>
> http://some_site_name/cenniki/producent-1/
> http://some_site_name/cenniki/producent-2/
>
> Is it possible with this form of two apps in one project ? I can be
> even :
>
> http://some_site_name/some_main_site/promocje/producent-1/
> http://some_site_name/some_main_site/cenniki/producent-1/
>
> Any ideas ?
>
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Django users" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/django-users?hl=en.
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to