Adrian Holovaty wrote:
> Default values aren't created at the SQL level -- they're enforced at
> the Django DB-API level.

OK, I figured that out the meantime, but it doesn't work for the 
BooleanField.

When I define the default value for my BooleanField to True and then 
create an object this field is set to False.

Here is the complete test source snippet:


models.py
...........................................................

class Person(models.Model):
     name  = models.CharField(maxlength=255)
     stupid = models.BooleanField(default=True)

...........................................................



views.py
............................................................
def add(request):
     manipulator = Person.AddManipulator()
     if request.POST:
         data = request.POST.copy()
         errors = manipulator.get_validation_errors(data)
         if not errors:
             manipulator.do_html2python(data)
             manipulator.save(data)
             return HttpResponseRedirect('/')
     else:
         errors = data = {}

     form = FormWrapper(manipulator, data, errors)
     return render_to_response('add.html', {'form' : form})
..............................................................



add.html
................................................................
<html>
   <body>
     <form action="/add/" method="post">
       Name: {{ form.name }}
       <input type="submit" value="Submit" />
     </form>
   </body>
</html>
..................................................................


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to