Why? Because phpMyAdmin, when accessing the homepage for the model's datatable, says this:
PRIMARY and INDEX keys should not both be set for column `user_id`
Does this run deeper than I thought?
Thakns a million for your help,
Carlos
On 10/4/06,
Carlos Yoder <[EMAIL PROTECTED]> wrote:
Hello guys,
I'm experiencing a weird thing. On my production setup, an OperationalError exception is being triggered while trying to invoke an AddManipulator.
I've zeroed in down to this (excerpt of my view follows)
def userprofile_add(request):
""" Handle adding new userprofiles (one2one rel to User objects) """
from django import forms
manipulator = UserProfile.AddManipulator ()
if request.POST:
# If data was POSTed, we're trying to create a new UserProfile.
new_data = request.POST.copy()
# Check for errors.
errors = manipulator.get_validation_errors (new_data)
if not errors:
# No errors. This means we can save the data!
manipulator.do_html2python(new_data)
new_userprofile = manipulator.save(new_data)
# Redirect to the object's "edit" page. Always use a redirect
# after POST data, so that reloads don't accidently create
# duplicate entires, and so users don't see the confusing
# "Repost POST data?" alert box in their browsers.
return HttpResponseRedirect("/my_data/")
else:
# No POST, so we want a brand new form without any data or errors.
errors = new_data = {}
As you can see, this is ver simple AddManipulator. For some reason my request MultiValueDict has properly set a NOT NULL value I pass via a hidden HTML input field, but the new_data dict doesn't. This field is the ubiquitous "user_id", that comes from request.user. As I said, it's properly passed from the form, and seen by request.POST... only new_data lacks it (it's set to None).
So, this should be centered aroudn either request.POST.copy() or do_html2python(), right?
This is funny, since on my dev environment (sqlite+windows) everything runs smoothly. This error only occurs on the production environment, which is on Bluehost (mysql+Linux).
Any ideas? I'm very very very close of finishing my first Django project, yay!
Best regards,
--
Carlos Yoder
http://blog.argentinaslovenia.com/
--
Carlos Yoder
http://blog.argentinaslovenia.com/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---