Opened 9 years ago

Closed 8 years ago

Last modified 7 years ago

#3060 closed defect (fixed)

[patch] broken Timestamp on manual created Users using postgres/sqlite

Reported by: Ronny Pfannschmidt Owned by: nobody
Component: Contrib apps Version:
Severity: normal Keywords:
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: yes Patch needs improvement: yes
Easy pickings: UI/UX:

Description

while adding a entry for unregistred Users i noticed, that the Model wont use correct timestamps for:

User.objects.get_or_create(username="UnReg",defaults={'id':-1})

,since its using LazyDate as default, wich does only the Date,
unfortunately Mysql is the only supported dbms accepted this, so i added a auto_now_add=True, wich resulted in sqlite and postgresql working, too

Attachments (1)

auth-timestamp-patch.diff (1.4 KB) - added by Ronny Pfannschmidt <ronny.pfannschmidt@…> 9 years ago.

Download all attachments as: .zip

Change History (8)

Changed 9 years ago by Ronny Pfannschmidt <ronny.pfannschmidt@…>

comment:1 Changed 9 years ago by [Cha0S]

test

comment:2 Changed 8 years ago by Simon G. <dev@…>

  • Component changed from Contrib apps to Admin interface
  • Triage Stage changed from Unreviewed to Ready for checkin

comment:3 Changed 8 years ago by Simon G. <dev@…>

  • Component changed from Admin interface to Contrib apps

comment:4 Changed 8 years ago by adrian

  • Needs tests set
  • Patch needs improvement set
  • Triage Stage changed from Ready for checkin to Accepted

Could we get a unit test that verifies this? Also, what exactly does "broken timestamp" mean? Finally, I'm not in favor of the patch, because auto_now_add is a hack that I'd like to get rid of eventually. If nothing else, it should use default=datetime.datetime.now, taking advantage of the callable default functionality.

comment:5 Changed 8 years ago by Ronny Pfannschmidt <ronny.pfannschmidt@…>

some dbms didnt accept the date from lazydate - but default=datetime.now is a better solution

comment:6 Changed 8 years ago by __hawkeye__

  • Resolution set to fixed
  • Status changed from new to closed

Looks to me like this was solved in [4985], when LazyDate was pulled.

Please reopen if this didn't fix it for you, but it sounds like you were happy with the solution used to replace LazyDate.

comment:7 Changed 7 years ago by jacob

  • Reporter changed from Ronny Pfannschmidt <ronny.pfannschmidt@…> to Ronny Pfannschmidt
Note: See TracTickets for help on using tickets.
Back to Top