On 16/11/06, James Bennett <[EMAIL PROTECTED]> wrote:
>
> On 11/14/06, Matthew Flanagan <[EMAIL PROTECTED]> wrote:
> > scroll down a little further on that page and you'll see that the User
> > model has:
> >
> >             last_login = models.DateTimeField(_('last login'),
> > default=models.LazyDate())
> >             date_joined = models.DateTimeField(_('date joined'),
> > default=models.LazyDate())
>
> Well, as far back as I can remember, default values have only ever
> been used when you actually display the values in a form to the user;
> they don't get auto-filled for you when you don't show the field.
> That's why User.objects.create_user only takes three arguments, but
> passes the full array of values to fill in a User instance.
>
> Or am I missing something here?

You must be missing something:

>>> from django.contrib.auth.models import User
>>> u = User(username='foo', password='bar')
>>> u.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "/xxx/django/db/models/base.py", line 204, in save
    ','.join(placeholders)), db_values)
  File "/xxx/django/db/backends/util.py", line 12, in execute
    return self.cursor.execute(sql, params)
psycopg.ProgrammingError: ERROR:  column "last_login" is of type
timestamp with time zone but expression is of type integer
HINT:  You will need to rewrite or cast the expression.

INSERT INTO "auth_user"
("username","first_name","last_name","email","password","is_staff","is_active","is_superuser","last_login","date_joined")
VALUES ('foo','','','','bar',False,True,False,2006-11-16,2006-11-16)

>
> --
> "May the forces of evil become confused on the way to your house."
>   -- George Carlin
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 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?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to