Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.
  • Root
  • » Django
  • » DateTimeField doesnt get future date. [RSS Feed]

#1 Dec. 12, 2010 21:29:50

Recep K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

DateTimeField doesnt get future date.


Hi i have a model which has a datetime field like

pub_date = models.DateTimeField("Etkinlik Tarihi")

this model is written to organize some events in a cafe. when i m trying to
create some events from the admin panel. if i choose today and now from the
date widget in admin; it works. if i choose a past date it works too. But if i
choose a future date, it says. Enter a valid date. i dont know is it a bug
about django or did i do sth. wrong in my model. here is my whole model.

p.s.: i'm using django trunk on my server

(InteractiveConsole)
>>> import django
>>> django.VERSION
(1, 3, 0, 'alpha', 1)
>>>
------------------------------------------------------------------
#!/usr/bin/python
#-*- coding: utf-8 -*-
from django.db import models
from photologue.models import Photo

class Etkinlik(models.Model):
name = models.CharField("Etkinlik Adı", max_length=100)
text = models.TextField("Etkinlik Metni", max_length=2000)
foto = models.ForeignKey(Photo)
pub_date = models.DateTimeField("Etkinlik Tarihi")
is_active = models.BooleanField("Aktif", default=True)

class Meta:
get_latest_by = "pub_date"
verbose_name = "Etkinlik"
verbose_name_plural = "Etkinlikler"

def __unicode__(self):
return u"%s - %s" %(self.name, self.text)

def get_absolute_url(self):
return "/etkinlik/%i/" % self.id
------------------------------------------------------------------


--
Yours,
Recep KIRMIZI <rkirm...@gmail.com>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#2 Dec. 13, 2010 02:33:46

Sam L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

DateTimeField doesnt get future date.


Sounds odd. What is the future date you're entering? Are you sure your
system has the right date format set, e.g. you're not entering a
MM/dd/yyyy date when the system is expecting a dd/MM/yyyy date or vice
versa?

On 13 December 2010 08:29, Recep KIRMIZI <rkirm...@gmail.com> wrote:
> Hi i have a model which has a datetime field like
>
>    pub_date = models.DateTimeField("Etkinlik Tarihi")
>
> this model is written to organize some events in a cafe. when i m trying to
> create some events from the admin panel. if i choose today and now from the
> date widget in admin; it works. if i choose a past date it works too. But if
> i choose a future date, it says. Enter a valid date. i dont know is it a bug
> about django or did i do sth. wrong in my model. here is my whole model.
>
> p.s.: i'm using django trunk on my server
>
> (InteractiveConsole)
>>>> import django
>>>> django.VERSION
> (1, 3, 0, 'alpha', 1)
>>>>
> ------------------------------------------------------------------
> #!/usr/bin/python
> #-*- coding: utf-8 -*-
> from django.db import models
> from photologue.models import Photo
>
> class Etkinlik(models.Model):
>    name = models.CharField("Etkinlik Adı", max_length=100)
>    text = models.TextField("Etkinlik Metni", max_length=2000)
>    foto = models.ForeignKey(Photo)
>    pub_date = models.DateTimeField("Etkinlik Tarihi")
>    is_active = models.BooleanField("Aktif", default=True)
>
>    class Meta:
>        get_latest_by = "pub_date"
>        verbose_name = "Etkinlik"
>        verbose_name_plural = "Etkinlikler"
>
>    def __unicode__(self):
>        return u"%s - %s" %(self.name, self.text)
>
>    def get_absolute_url(self):
>        return "/etkinlik/%i/" % self.id
> ------------------------------------------------------------------
>
>
> --
> Yours,
> Recep KIRMIZI <rkirm...@gmail.com>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#3 Dec. 13, 2010 02:45:38

Recep K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

DateTimeField doesnt get future date.


On Mon, 13 Dec 2010 13:33:37 +1100
Sam Lai <samuel....@gmail.com> wrote:

> Sounds odd. What is the future date you're entering? Are you sure your
> system has the right date format set, e.g. you're not entering a
> MM/dd/yyyy date when the system is expecting a dd/MM/yyyy date or vice
> versa?
>
This is what i tried just now:
Date: 23/12/2010
Time: 12:00:00
i've set these values from the datepicker applet in admin panel.

now i recognized sth. I guess it's expecting as u said. MM/dd/yyyy
bec. i've chosen a past date and it works. Coinsidencely today is 13rd. of
December. so the days before this date in this month are like 11/12/2010 so it
's ok both day or month less then 12 :)
i tried past month. 25th it failed again. how can i change the default datetime
format?

> On 13 December 2010 08:29, Recep KIRMIZI <rkirm...@gmail.com> wrote:
> > Hi i have a model which has a datetime field like
> >
> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
> >
> > this model is written to organize some events in a cafe. when i m trying to
> > create some events from the admin panel. if i choose today and now from the
> > date widget in admin; it works. if i choose a past date it works too. But
> > if i choose a future date, it says. Enter a valid date. i dont know is it a
> > bug about django or did i do sth. wrong in my model. here is my whole model.
> >
> > p.s.: i'm using django trunk on my server
> >
> > (InteractiveConsole)
> >>>> import django
> >>>> django.VERSION
> > (1, 3, 0, 'alpha', 1)
> >>>>
> > ------------------------------------------------------------------
> > #!/usr/bin/python
> > #-*- coding: utf-8 -*-
> > from django.db import models
> > from photologue.models import Photo
> >
> > class Etkinlik(models.Model):
> >    name = models.CharField("Etkinlik Adı", max_length=100)
> >    text = models.TextField("Etkinlik Metni", max_length=2000)
> >    foto = models.ForeignKey(Photo)
> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
> >    is_active = models.BooleanField("Aktif", default=True)
> >
> >    class Meta:
> >        get_latest_by = "pub_date"
> >        verbose_name = "Etkinlik"
> >        verbose_name_plural = "Etkinlikler"
> >
> >    def __unicode__(self):
> >        return u"%s - %s" %(self.name, self.text)
> >
> >    def get_absolute_url(self):
> >        return "/etkinlik/%i/" % self.id
> > ------------------------------------------------------------------
> >
> >
> > --
> > Yours,
> > Recep KIRMIZI <rkirm...@gmail.com>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>


--
Recep KIRMIZI <rkirm...@gmail.com>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#4 Dec. 13, 2010 03:23:15

Sam L.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

DateTimeField doesnt get future date.


On 13 December 2010 13:45, Recep KIRMIZI <rkirm...@gmail.com> wrote:
> On Mon, 13 Dec 2010 13:33:37 +1100
> Sam Lai <samuel....@gmail.com> wrote:
>
>> Sounds odd. What is the future date you're entering? Are you sure your
>> system has the right date format set, e.g. you're not entering a
>> MM/dd/yyyy date when the system is expecting a dd/MM/yyyy date or vice
>> versa?
>>
> This is what i tried just now:
> Date: 23/12/2010
> Time: 12:00:00
> i've set these values from the datepicker applet in admin panel.
>
> now i recognized sth. I guess it's expecting as u said. MM/dd/yyyy
> bec. i've chosen a past date and it works. Coinsidencely today is 13rd. of
> December. so the days before this date in this month are like 11/12/2010 so
> it 's ok both day or month less then 12 :)
> i tried past month. 25th it failed again. how can i change the default
> datetime format?

Windows or Linux?

>> On 13 December 2010 08:29, Recep KIRMIZI <rkirm...@gmail.com> wrote:
>> > Hi i have a model which has a datetime field like
>> >
>> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
>> >
>> > this model is written to organize some events in a cafe. when i m trying
>> > to create some events from the admin panel. if i choose today and now from
>> > the date widget in admin; it works. if i choose a past date it works too.
>> > But if i choose a future date, it says. Enter a valid date. i dont know is
>> > it a bug about django or did i do sth. wrong in my model. here is my whole
>> > model.
>> >
>> > p.s.: i'm using django trunk on my server
>> >
>> > (InteractiveConsole)
>> >>>> import django
>> >>>> django.VERSION
>> > (1, 3, 0, 'alpha', 1)
>> >>>>
>> > ------------------------------------------------------------------
>> > #!/usr/bin/python
>> > #-*- coding: utf-8 -*-
>> > from django.db import models
>> > from photologue.models import Photo
>> >
>> > class Etkinlik(models.Model):
>> >    name = models.CharField("Etkinlik Adı", max_length=100)
>> >    text = models.TextField("Etkinlik Metni", max_length=2000)
>> >    foto = models.ForeignKey(Photo)
>> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
>> >    is_active = models.BooleanField("Aktif", default=True)
>> >
>> >    class Meta:
>> >        get_latest_by = "pub_date"
>> >        verbose_name = "Etkinlik"
>> >        verbose_name_plural = "Etkinlikler"
>> >
>> >    def __unicode__(self):
>> >        return u"%s - %s" %(self.name, self.text)
>> >
>> >    def get_absolute_url(self):
>> >        return "/etkinlik/%i/" % self.id
>> > ------------------------------------------------------------------
>> >
>> >
>> > --
>> > Yours,
>> > Recep KIRMIZI <rkirm...@gmail.com>
>> >
>> > --
>> > You received this message because you are subscribed to the Google Groups
>> > "Django users" group.
>> > To post to this group, send email to django-us...@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > django-users+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> >http://groups.google.com/group/django-users?hl=en.
>> >
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To post to this group, send email to django-us...@googlegroups.com.
>> To unsubscribe from this group, send email to
>> django-users+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>>http://groups.google.com/group/django-users?hl=en.
>>
>
>
> --
> Recep KIRMIZI <rkirm...@gmail.com>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>
>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

#5 Dec. 13, 2010 04:08:03

Recep K.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

DateTimeField doesnt get future date.


On Mon, 13 Dec 2010 14:23:06 +1100
Sam Lai <samuel....@gmail.com> wrote:

> On 13 December 2010 13:45, Recep KIRMIZI <rkirm...@gmail.com> wrote:
> > On Mon, 13 Dec 2010 13:33:37 +1100
> > Sam Lai <samuel....@gmail.com> wrote:
> >
> >> Sounds odd. What is the future date you're entering? Are you sure your
> >> system has the right date format set, e.g. you're not entering a
> >> MM/dd/yyyy date when the system is expecting a dd/MM/yyyy date or vice
> >> versa?
> >>
> > This is what i tried just now:
> > Date: 23/12/2010
> > Time: 12:00:00
> > i've set these values from the datepicker applet in admin panel.
> >
> > now i recognized sth. I guess it's expecting as u said. MM/dd/yyyy
> > bec. i've chosen a past date and it works. Coinsidencely today is 13rd. of
> > December. so the days before this date in this month are like 11/12/2010 so
> > it 's ok both day or month less then 12 :)
> > i tried past month. 25th it failed again. how can i change the default
> > datetime format?
>
> Windows or Linux?
>
i m using linux, and i fixed it by adding

USE_L10N = True

in my settings.py

> >> On 13 December 2010 08:29, Recep KIRMIZI <rkirm...@gmail.com> wrote:
> >> > Hi i have a model which has a datetime field like
> >> >
> >> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
> >> >
> >> > this model is written to organize some events in a cafe. when i m trying
> >> > to create some events from the admin panel. if i choose today and now
> >> > from the date widget in admin; it works. if i choose a past date it
> >> > works too. But if i choose a future date, it says. Enter a valid date. i
> >> > dont know is it a bug about django or did i do sth. wrong in my model.
> >> > here is my whole model.
> >> >
> >> > p.s.: i'm using django trunk on my server
> >> >
> >> > (InteractiveConsole)
> >> >>>> import django
> >> >>>> django.VERSION
> >> > (1, 3, 0, 'alpha', 1)
> >> >>>>
> >> > ------------------------------------------------------------------
> >> > #!/usr/bin/python
> >> > #-*- coding: utf-8 -*-
> >> > from django.db import models
> >> > from photologue.models import Photo
> >> >
> >> > class Etkinlik(models.Model):
> >> >    name = models.CharField("Etkinlik Adı", max_length=100)
> >> >    text = models.TextField("Etkinlik Metni", max_length=2000)
> >> >    foto = models.ForeignKey(Photo)
> >> >    pub_date = models.DateTimeField("Etkinlik Tarihi")
> >> >    is_active = models.BooleanField("Aktif", default=True)
> >> >
> >> >    class Meta:
> >> >        get_latest_by = "pub_date"
> >> >        verbose_name = "Etkinlik"
> >> >        verbose_name_plural = "Etkinlikler"
> >> >
> >> >    def __unicode__(self):
> >> >        return u"%s - %s" %(self.name, self.text)
> >> >
> >> >    def get_absolute_url(self):
> >> >        return "/etkinlik/%i/" % self.id
> >> > ------------------------------------------------------------------
> >> >
> >> >
> >> > --
> >> > Yours,
> >> > Recep KIRMIZI <rkirm...@gmail.com>
> >> >
> >> > --
> >> > You received this message because you are subscribed to the Google
> >> > Groups "Django users" group.
> >> > To post to this group, send email to django-us...@googlegroups.com.
> >> > To unsubscribe from this group, send email to
> >> > django-users+unsubscr...@googlegroups.com.
> >> > For more options, visit this group at
> >> >http://groups.google.com/group/django-users?hl=en.
> >> >
> >> >
> >>
> >> --
> >> You received this message because you are subscribed to the Google Groups
> >> "Django users" group.
> >> To post to this group, send email to django-us...@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> django-users+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >>http://groups.google.com/group/django-users?hl=en.
> >>
> >
> >
> > --
> > Recep KIRMIZI <rkirm...@gmail.com>
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To post to this group, send email to django-us...@googlegroups.com.
> > To unsubscribe from this group, send email to
> > django-users+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/django-users?hl=en.
> >
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To post to this group, send email to django-us...@googlegroups.com.
> To unsubscribe from this group, send email to
> django-users+unsubscr...@googlegroups.com.
> For more options, visit this group at
>http://groups.google.com/group/django-users?hl=en.
>


--
Recep KIRMIZI <rkirm...@gmail.com>

--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email to
django-users+unsubscr...@googlegroups.com.
For more options, visit this group athttp://groups.google.com/group/django-users?hl=en.

Offline

  • Root
  • » Django
  • » DateTimeField doesnt get future date. [RSS Feed]

Board footer

Moderator control

Enjoy the 17th of October
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support