2011-06-22 15 views
2

'save_as'はインラインで動作する必要があります。私はむしろトレースバックに戸惑いがちですが、自分のコードの関与はそれほどありません。Django admin 'save_as' with inlines

問題は、追加のフォームを保存するときに「」に設定されているインラインのidのようです。

Traceback: 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/core/handlers/base.py" in get_response 
    111.       response = callback(request, *callback_args, **callback_kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/contrib/admin/options.py" in wrapper 
    307.     return self.admin_site.admin_view(view)(*args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view 
    93.      response = view_func(request, *args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/views/decorators/cache.py" in _wrapped_view_func 
    79.   response = view_func(request, *args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/contrib/admin/sites.py" in inner 
    197.    return view(request, *args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapper 
    28.    return bound_func(*args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/utils/decorators.py" in _wrapped_view 
    93.      response = view_func(request, *args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/utils/decorators.py" in bound_func 
    24.     return func(self, *args2, **kwargs2) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/transaction.py" in inner 
    217.     res = func(*args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/contrib/admin/options.py" in add_view 
    879.         prefix=prefix, queryset=inline.queryset(request)) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/models.py" in __init__ 
    682.             queryset=qs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/models.py" in __init__ 
    415.   super(BaseModelFormSet, self).__init__(**defaults) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/formsets.py" in __init__ 
    47.   self._construct_forms() 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/formsets.py" in _construct_forms 
    108.    self.forms.append(self._construct_form(i)) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/models.py" in _construct_form 
    691.   form = super(BaseInlineFormSet, self)._construct_form(i, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/forms/models.py" in _construct_form 
    437.     connection=connections[self.get_queryset().db]) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/models/fields/subclassing.py" in inner 
    53.    return func(*args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/models/fields/subclassing.py" in inner 
    53.    return func(*args, **kwargs) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/models/fields/__init__.py" in get_db_prep_lookup 
    306.    value = self.get_prep_lookup(lookup_type, value) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/models/fields/__init__.py" in get_prep_lookup 
    292.    return self.get_prep_value(value) 
File "/Users/andybaker/.virtualenvs/nmdc_test/lib/python2.7/site-packages/django/db/models/fields/__init__.py" in get_prep_value 
    479.   return int(value) 

Exception Type: ValueError at /admin/property_manager/property/add/ 
Exception Value: invalid literal for int() with base 10: '' 
+0

intフィールドが空白のようです。それ以上の情報がないと、どのようなことを知るのが難しいのですか? – Thomas

+0

問題の解決を支援するには、プロジェクトをクローンし、モデルと管理者を最小限に抑え、エラーを投げ捨てて質問に投稿してください。 – Udi

答えて