Уведомления

Группа в Telegram: @pythonsu

#1 Окт. 3, 2010 15:16:12

Dock
От:
Зарегистрирован: 2010-05-26
Сообщения: 8
Репутация: +  0  -
Профиль   Отправить e-mail  

Изменение отображения RadioSelect

Решила изменить отображение виджета RadioSelect. В forms.py написала следующее:

from django.forms.widgets import RadioFieldRenderer

class MyRadioFieldRenderer(RadioFieldRenderer):
def render(self):
return mark_safe(u'<ul>\n%s\n</ul>' % u'\n'.join([u'%s &nbsp; &nbsp; &nbsp;'
% force_unicode(w) for w in self]))

class MyRadioSelect(forms.RadioSelect):
renderer = MyRadioFieldRenderer


class ActivityForm(forms.Form):
form_kind = forms.ModelChoiceField(queryset = Kind.objects.all(), empty_label=None, widget=MyRadioSelect)
Выдает ошибку
 Traceback (most recent call last):

File "c:\Program Files\Python26\lib\site-packages\django\core\servers\basehttp.py", line 280, in run
self.result = application(self.environ, self.start_response)

File "c:\Program Files\Python26\lib\site-packages\django\core\servers\basehttp.py", line 674, in __call__
return self.application(environ, start_response)

File "c:\Program Files\Python26\lib\site-packages\django\core\handlers\wsgi.py", line 241, in __call__
response = self.get_response(request)

File "c:\Program Files\Python26\lib\site-packages\django\core\handlers\base.py", line 142, in get_response
return self.handle_uncaught_exception(request, resolver, exc_info)

File "c:\Program Files\Python26\lib\site-packages\django\core\handlers\base.py", line 166, in handle_uncaught_exception
return debug.technical_500_response(request, *exc_info)

File "c:\Program Files\Python26\lib\site-packages\django\views\debug.py", line 58, in technical_500_response
html = reporter.get_traceback_html()

File "c:\Program Files\Python26\lib\site-packages\django\views\debug.py", line 109, in get_traceback_html
frames = self.get_traceback_frames()

File "c:\Program Files\Python26\lib\site-packages\django\views\debug.py", line 228, in get_traceback_frames
pre_context_lineno, pre_context, context_line, post_context = self._get_lines_from_file(filename, lineno, 7, loader, module_name)

File "c:\Program Files\Python26\lib\site-packages\django\views\debug.py", line 209, in _get_lines_from_file
context_line = source[lineno].strip('\n')

IndexError: list index out of range
Подскажите, как это можно исправить.



Офлайн

Board footer

Модераторировать

Powered by DjangoBB

Lo-Fi Version