﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
10580	django calls several views at once.	iigor	nobody	"Is it normal behaviour?
In example below, I try to call myapp2.view.cat2_view through ""/a/""
url-path. It's calling, however another views myapp1.view.cat1_viewis
also calling with it at same time.

{{{
F:\igor\apps\devel\django\temp>django-admin.py startproject myproj

F:\igor\apps\devel\django\temp>cd myproj

F:\igor\apps\devel\django\temp\myproj>python manage.py startapp myapp1

F:\igor\apps\devel\django\temp\myproj>python manage.py startapp myapp2

F:\igor\apps\devel\django\temp\myproj>python manage.py syncdb
Creating table auth_permission
Creating table auth_group
Creating table auth_user
Creating table auth_message
Creating table django_content_type
Creating table django_session
Creating table django_site
Creating table myapp1_cats

You just installed Django's auth system, which means you don't have
any superusers defined.
Would you like to create one now? (yes/no): yes
Username: igor
E-mail address: igor
Error: That e-mail address is invalid.
E-mail address: igor@prettysin.info
Password:
Password (again):
Superuser created successfully.
Installing index for auth.Permission model
Installing index for auth.Message model
}}}

#creating models & views, editing urls, settings.py. (see below)

{{{
F:\igor\apps\devel\django\temp\myproj>python manage.py runserver
Validating models...
0 errors found

Django version 1.0.2 final, using settings 'myproj.settings'
Development server is running at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.

[22/Mar/2009 09:02:14] ""GET /a/ HTTP/1.1"" 200 0
[<Cats: 123>]
[22/Mar/2009 09:02:15] ""GET /a/ HTTP/1.1"" 200 4
[<Cats: 123>, <Cats: 123>]
[22/Mar/2009 09:02:16] ""GET /a/ HTTP/1.1"" 200 8
[<Cats: 123>, <Cats: 123>, <Cats: 123>]
[22/Mar/2009 09:02:17] ""GET /a/ HTTP/1.1"" 200 12
[<Cats: 123>, <Cats: 123>, <Cats: 123>, <Cats: 123>]
[22/Mar/2009 09:02:18] ""GET /a/ HTTP/1.1"" 200 16
[<Cats: 123>, <Cats: 123>, <Cats: 123>, <Cats: 123>, <Cats: 123>]
[22/Mar/2009 09:02:18] ""GET /a/ HTTP/1.1"" 200 20
[<Cats: 123>, <Cats: 123>, <Cats: 123>, <Cats: 123>, <Cats: 123>,
<Cats: 123>]
}}}


{{{
###########   myapp1.models
from django.db import models

# Create your models here.

class Cats(models.Model):
   name = models.CharField(max_length=255,blank=True)

   def __unicode__(self):
       return u'%s' % self.name


}}}

{{{
###########    myapp1.views
# Create your views here.
from myapp1.models  import Cats



def cat_view(request):
   cat = Cats(name=""123"")
   cat.save()

   # This prints to console!
   print Cats.objects.all()

   assert False
   return HttpResponse(""%s"" % cat.name)

}}}


{{{
#########  myapp2.views
# Create your views here.

from myapp1.models import Cats
from django.http import HttpResponse

def cat2_view(request):
   cats = Cats.objects.all()


   res = ''
   for cat in cats:
       res = res + '%s ' % cat.name

  return HttpResponse(res)


}}}

{{{
########   urls
from django.conf.urls.defaults import *

urlpatterns = patterns('',
   (r'^a/', 'myapp2.views.cat2_view'),
   (r'^', 'myapp1.views.cat_view'),
)

}}}



I replaced "" (r'^a/', 'myapp2.views.cat2_view'), "" on ""(r'^',
'myapp2.views.cat2_view'),"" and this feature has gone away.
I guess, this's not normal behaviour.
"		closed	Uncategorized	1.0		invalid			Unreviewed	0	0	0	0	0	0
