Traceback (most recent call last):
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\db\models\fields\__init__.py", line 938, in to_python
return int(value)
ValueError: invalid literal for int() with base 10: ''
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\core\handlers\exception.py", line 41, in inner
response = get_response(request)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\core\handlers\base.py", line 187, in _get_response
response = self.process_exception_by_middleware(e, request)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\core\handlers\base.py", line 185, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\contrib\admin\options.py", line 551, in wrapper
return self.admin_site.admin_view(view)(*args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\views\decorators\cache.py", line 57, in _wrapped_view_func
response = view_func(request, *args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\contrib\admin\sites.py", line 224, in inner
return view(request, *args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\contrib\admin\options.py", line 1511, in change_view
return self.changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\utils\decorators.py", line 67, in _wrapper
return bound_func(*args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\utils\decorators.py", line 149, in _wrapped_view
response = view_func(request, *args, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\utils\decorators.py", line 63, in bound_func
return func.__get__(self, type(self))(*args2, **kwargs2)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\contrib\admin\options.py", line 1408, in changeform_view
return self._changeform_view(request, object_id, form_url, extra_context)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\contrib\admin\options.py", line 1447, in _changeform_view
if all_valid(formsets) and form_validated:
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 460, in all_valid
if not formset.is_valid():
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 321, in is_valid
self.errors
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 295, in errors
self.full_clean()
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 344, in full_clean
form = self.forms[i]
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\utils\functional.py", line 35, in __get__
res = instance.__dict__[self.name] = self.func(instance)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 144, in forms
for i in range(self.total_form_count())]
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\formsets.py", line 144, in <listcomp>
for i in range(self.total_form_count())]
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\models.py", line 895, in _construct_form
form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\forms\models.py", line 594, in _construct_form
pk = to_python(pk)
File "C:\Users\admin\AppData\Roaming\Python\Python36\site-packages\django\db\models\fields\__init__.py", line 943, in to_python
params={'value': value},
django.core.exceptions.ValidationError: ["Значение '' должно быть целым числом."]
[19/May/2017 15:36:44] "POST /admin/clients/client/10007/change/ HTTP/1.1" 500 160192
class Question(models.Model):
question_text = models.CharField(max_length=200)
pub_date = models.DateTimeField('date published')
def __str__(self):
return self.question_text
class ChoiceAdmin(admin.ModelAdmin):
.....
def questions(self, obj):
return obj.question_set.last()
Questions.short_description = u'Последняя услуга'
я создал уже отдельный файл
name_tags.py
В шаблоне
и выдает уже ошибку