List Info

Thread: DateTimeField - Value Error - 'Year is out of Range'




DateTimeField - Value Error - 'Year is out of Range'
user name
2006-10-30 12:37:00
I'm am having a problem with the DateTimeField when I save
the data 
through the related class.

Example

class Transaction:
user = 
ForeignKey(UserProfile,edit_inline=models.TABULAR,num_extra_
on_change=0)
DateTimeField(auto_now_add=True, blank=True)

When I add data to Transaction, through the Admin,
everything seems 
fine. I can view the the individual transactions without a
problem.

I can see the transaction when I first go to a related
UserProfile.  
However, as soon as I save the UserProfile I get the
following error
"Value Error - Year out of Range".

Looking at the database it is clear that when I do a save
through the 
UserProfile, the DateTimeField is being changed for related
transaction 
field.   I had understood from the documentation that
auto_now_add only 
changed the datefield when the object was first created.  
Can anybody 
explain where I'm going wrong.

MerMer


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

DateTimeField - Value Error - 'Year is out of Range'
user name
2006-10-30 20:31:10
I have recently had the same problem, but I solved it adding
null=True
to the DateTimeField.

Good luck!
Aidas Bendoraitis aka Archatas



On 10/30/06, Merric Mercer <merrichiveonline.co.uk> wrote:
>
> I'm am having a problem with the DateTimeField when I
save the data
> through the related class.
>
> Example
>
> class Transaction:
> user =
>
ForeignKey(UserProfile,edit_inline=models.TABULAR,num_extra_
on_change=0)
> DateTimeField(auto_now_add=True, blank=True)
>
> When I add data to Transaction, through the Admin,
everything seems
> fine. I can view the the individual transactions
without a problem.
>
> I can see the transaction when I first go to a related
UserProfile.
> However, as soon as I save the UserProfile I get the
following error
> "Value Error - Year out of Range".
>
> Looking at the database it is clear that when I do a
save through the
> UserProfile, the DateTimeField is being changed for
related transaction
> field.   I had understood from the documentation that
auto_now_add only
> changed the datefield when the object was first
created.   Can anybody
> explain where I'm going wrong.
>
> MerMer
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Django users" group.
To post to this group, send email to django-usersgooglegroups.com
To unsubscribe from this group, send email to
django-users-unsubscribegooglegroups.com
For more options, visit this group at http://gr
oups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )