Opened 9 years ago

Closed 9 years ago

#1794 closed defect (worksforme)

DateTimeField with unique=True broken

Reported by: public@… Owned by: adrian
Component: Core (Other) Version: master
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Using the DateTimeField with "unique=True" returns the following error, when inputting new values:

ProgrammingError at /django/admin/polls/poll/add/
ERROR: invalid input syntax for type timestamp with time zone: "16:08" SELECT "polls_poll"."id","polls_poll"."question","polls_poll"."pub_date" FROM "polls_poll" WHERE ("polls_poll"."pub_date" = '16:08')
Request Method: 	POST
Request URL: 	http://db-projects.org:8000/django/admin/polls/poll/add/
Exception Type: 	ProgrammingError
Exception Value: 	ERROR: invalid input syntax for type timestamp with time zone: "16:08" SELECT "polls_poll"."id","polls_poll"."question","polls_poll"."pub_date" FROM "polls_poll" WHERE ("polls_poll"."pub_date" = '16:08')
Exception Location: 	/usr/lib/python2.3/site-packages/django/db/backends/util.py in execute, line 12

The demonstration model:

class Poll(models.Model):
    question = models.CharField(maxlength=200)
    pub_date = models.DateTimeField('date published', unique=True)
    def __str__(self):
        return self.question
    class Admin:
        pass

It works without problems if I'm not using "unique=True".

SVN revision 2864
Postgresql 7.4.7
Python 2.3.5

Change History (1)

comment:1 Changed 9 years ago by Gary Wilson <gary.wilson@…>

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

I could not reproduce this error.

Note: See TracTickets for help on using tickets.
Back to Top