On Mon, Jun 1, 2009 at 5:09 PM, Robocop <[email protected]> wrote:
> > Hello, > I'm trying to deploy another developer's blog code, and have run into > some snags with their ModelForm for adding entries. > > The segment of code that triggers the error in my views.py: > http://dpaste.com/50238/ > > The model and modelforms for both the blog, and for the entries: > http://dpaste.com/50237/ > > The Traceback: > http://dpaste.com/50240/ > > Now my templates seem to be working fine, and the form is validated > properly on POST. I can get at all the attributes of the form, and > they all look correct. It's only when i save the form data that i get > the error. Any help would be greatly appreciated, i've been trying to > sort this out all day and don't seem to be making much progress. Why do you say it is the e.save() in your first dpaste that causes the error? The traceback: Traceback (most recent call last): File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line 558, in run File "build/bdist.linux-i686/egg/flup/server/fcgi_base.py", line 1116, in handler File "/usr/local/lib/python2.4/site-packages/django/core/handlers/wsgi.py", line 243, in __call__ response = middleware_method(request, response) File "/usr/local/lib/python2.4/site-packages/django/contrib/redirects/middleware.py", line 11, in process_response r = Redirect.objects.get(site__id__exact=settings.SITE_ID, old_path=path) File "/usr/local/lib/python2.4/site-packages/django/db/models/manager.py", line 93, in get return self.get_query_set().get(*args, **kwargs) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 298, in get num = len(clone) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 154, in __len__ self._result_cache = list(self.iterator()) File "/usr/local/lib/python2.4/site-packages/django/db/models/query.py", line 269, in iterator for row in self.query.results_iter(): File "/usr/local/lib/python2.4/site-packages/django/db/models/sql/query.py", line 206, in results_iter for rows in self.execute_sql(MULTI): File "/usr/local/lib/python2.4/site-packages/django/db/models/sql/query.py", line 1700, in execute_sql cursor.execute(sql, params) File "/usr/local/lib/python2.4/site-packages/django/db/backends/util.py", line 19, in execute return self.cursor.execute(sql, params) File "/usr/local/lib/python2.4/site-packages/django/db/backends/mysql/base.py", line 83, in execute return self.cursor.execute(query, args) File "/usr/local/lib/python2.4/site-packages/MySQL_python-1.2.2-py2.4-linux-i686.egg/MySQLdb/cursors.py", line 166, in execute File "/usr/local/lib/python2.4/site-packages/MySQL_python-1.2.2-py2.4-linux-i686.egg/MySQLdb/connections.py", line 35, in defaulterrorhandler ProgrammingError: (1146, "Table 'usbroker_brokerage.django_redirect' doesn't exist") doesn't support that statement. Not only is your e.save() nowhere to be seen in that traceback, nothing from your code appears anywhere in that traceback. Also, the error message that accompanies the generic '1146 error' shows the problem is a table that does not exist. Specifically, a table named django_redirect. Looking further back in the traceback you can see the code that is issuing the query causing the exception is in django/contrib/redirects/middleware.py. Doc for that middleware is here: http://docs.djangoproject.com/en/dev/ref/contrib/redirects/ and it states that this middleware only does something when a response code of 404 is being returned. I'd guess somehow your form-save code path is resulting in a 404 (redirecting to a nonexistent url?), causing this middleware to kick in, and it's running into trouble because apparently you didn't run manage.py syncdb after adding 'django.contrib.redirects' to your INSTALLED_APPS. Karen --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---

