#urls.py urlpatterns = patterns('', (r'^edit/(?P<sendmail_id>\d+)/$', views.edit), r'^send/$', views.send), )
#vews.py def edit(request): d= get_object_or_404(sendmail, pk=request.GET['sendmail.id']) a = sendmail.objects.filter(city=d) return render_to_response('edit.html', {'a' : a}) def send(request): city = sendmail.objects.order_by('-publication_date')[:10] return render_to_response('otpravka.html', {'city' : city} ) )
Environment: Request Method: GET Request URL: http://127.0.0.1:8000/edit/12/ Django Version: 1.4.1 Python Version: 2.7.3 Installed Applications: ('django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'cs', 'polls') Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 111. response = callback(request, *callback_args, **callback_kwargs) Exception Type: TypeError at /edit/12/ Exception Value: edit() got an unexpected keyword argument 'sendmail_id'
/send/
<TR onclick="window.open('http://127.0.0.1:8000/edit/{{sendmail.id}}','Карточка',' width=800,height=800,top=0')" method="get" >
{% if a %} <form class="form-container" action="/update/" method="post"> <div class="form-title"><h3>Редактирование</h2></div> <div class="form-title">Город</div> <input class="form-field" type="text" name="city" value="{{senmdail.city}}" /><br /> </form> {% endif %}