Re: How to format datetime stamp in JS like it is doing by the date template tag?

2024-03-21 Thread the.one.abo...@gmail.com
at); > > > > // Use the formattedDateTime variable wherever you want to display the > timestamp in your page console.log("Horodatage formaté :", > formattedDateTime); > > > > > > With this approach, your JavaScript code will automatically adapt to the &

Re: How to format datetime stamp in JS like it is doing by the date template tag?

2024-03-21 Thread Matthias Yeni
eding to hardcode the formatting of the datetime string into your JavaScript code. Le jeu. 21 mars 2024 à 12:13, the.one.abo...@gmail.com < the.one.above.all.ti...@gmail.com> a écrit : > Hello, > > I have customizing Django admin by adding a datetime stamp to the page > using JavaScr

How to format datetime stamp in JS like it is done by the date template tag?

2024-03-21 Thread the.one.abo...@gmail.com
Hello everyone, I am customizing Django admin by adding a datetime stamp to the page using JavaScript. I want to format the datetime stamp according to the format set by Django. It is possible to get the DATETIME_FORMAT using the get_format() method in JS which is "'j M Y, P&#x

How to format datetime stamp in JS like it is doing by the date template tag?

2024-03-21 Thread the.one.abo...@gmail.com
Hello, I have customizing Django admin by adding a datetime stamp to the page using JavaScript. I want to format the datetime stamp according to the format set by Django. It is possible to get the DATETIME_FORMAT using the get_format() method in JS. But, this format is not supported by the

Re: django datetime field and timefield provide different times....

2022-09-20 Thread Muhammad Juwaini Abdul Rahman
Check your timezone in settings.py. On Tue, 20 Sep 2022 at 21:38, Kenn_ Kiragu wrote: > django datetime field and timefield provide different times when set to > auto_now. The datetime field is three hrs behind.. Anyone know what could > be causing this? > > -- > You rec

django datetime field and timefield provide different times....

2022-09-20 Thread Kenn_ Kiragu
django datetime field and timefield provide different times when set to auto_now. The datetime field is three hrs behind.. Anyone know what could be causing this? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from

Re: Django Foreign key field require dependent on another datetime field

2022-04-09 Thread Antonis Christofides
Tayef wrote: I want to create a *Foreign key *which is *require if another datetime value is greater than any year* (like 2014). How can I create that on Django Models. Or I should do that in frontend. (I will use rest framework) -- You received this message because you are subscribed to t

Django Foreign key field require dependent on another datetime field

2022-04-09 Thread Mehedi Hasan Tayef
I want to create a *Foreign key *which is *require if another datetime value is greater than any year* (like 2014). How can I create that on Django Models. Or I should do that in frontend. (I will use rest framework) -- You received this message because you are subscribed to the Google Groups

Re: Difference in datetime with timezone

2022-03-30 Thread Andrés Alvarez
ulating that object with > attributes. An obvious example is that you can django the > DJANGO_SETTINGS_MODULES environment variable to specify a different > settings file. > > Now, regarding what you asked, the pytz documentation has the following > warning: > > Unfortunat

Re: Difference in datetime with timezone

2022-03-30 Thread Antonis Christofides
tely using the tzinfo argument of the standard datetime constructors ‘’does not work’’ with pytz for many timezones. I don't remember the correct way to do it, since I'm always confused by how pytz works, and also its usage is deprecated because of the existence of the new &

Re: Difference in datetime with timezone

2022-03-29 Thread Andrés Alvarez
, blank=True) is_suspended = models.BooleanField(default=False) start_at = models.DateTimeField(null=True) finish_at = models.DateTimeField(null=True) # utils.py from datetime import datetime, time import pytz from settings.py import TIME_ZONE def get_start_at(date): """O

Re: Difference in datetime with timezone

2022-03-28 Thread Antonis Christofides
models.DateTimeField(null=True) Here are my values to create the register: OrderedDict([('has_individual_budget', False), ('name', 'plan test create program start_at datetime'), ('program_budget', '0'), ('uuid4', 'd6effacf-3c1

Difference in datetime with timezone

2022-03-28 Thread Andrés Alvarez
values to create the register: OrderedDict([('has_individual_budget', False), ('name', 'plan test create program start_at datetime'), ('program_budget', '0'), ('uuid4', 'd6effacf-3c19-48db-ab06-5af1d97df599'), ('country_list&#

Specifying the value format for a DateTimeInput using type=datetime-local, especially when using inline formsets

2022-01-22 Thread bnmng
put widget where type=’datetime-local’, specify the default format to include the T in the middle of the date-time string: widgets={ 'when':forms.DateTimeInput( format='%Y-%m-%dT%H:%M:%S', attrs={'type':'datetime-local'} ), ... } This was driving me crazy! I

Re: DateTime widget in default CreateView form

2021-10-08 Thread Anil Felipe Duggirala
On Fri, Oct 8, 2021, at 10:57 AM, Iyanuoluwa Loko wrote: > The date-time has to accept a date, and if you input the date in the > textbox in the accepted django format, it will work fine. To have the > calendar icon, it is a widget, and you ycan call it by editing the HTML > input type, or addin

Re: DateTime widget in default CreateView form

2021-10-08 Thread Iyanuoluwa Loko
ch for the link MR INDIA. > That is exactly what Im looking to do, however, its not working for me for > some reason. > How can I check if I am getting the desired result in my rendered HTML? > I am working with a DateTimeField. So I should be getting a > type='datetime'

Re: DateTime widget in default CreateView form

2021-10-08 Thread Anil Felipe Duggirala
c-class-based-view-widget > Hope this helps, Thanks very much for the link MR INDIA. That is exactly what Im looking to do, however, its not working for me for some reason. How can I check if I am getting the desired result in my rendered HTML? I am working with a DateTimeField. So I should be get

Re: DateTime widget in default CreateView form

2021-10-08 Thread MR INDIA
Answer to this query on stack overflow Raw link: https://stackoverflow.com/questions/27321692/override-a-django-generic-class-based-view-widget Hope this helps, A fellow django developer On Friday,

Re: DateTime widget in default CreateView form

2021-10-07 Thread Anil Felipe Duggirala
On Thu, Oct 7, 2021, at 5:50 PM, sum abiut wrote: > You can use modelform. > > in your form.py you can do something like this > > # setup date picker start > class DateInput(forms.DateInput): > input_type = 'date' > > class Formname(forms.ModelForm): > class Meta: >

Re: DateTime widget in default CreateView form

2021-10-07 Thread sum abiut
sponse. > I have created a simple class based CreateView for a model that has a > DateTime attribute. > Simply rendering the form using the {{ form.as_p }} tag in the template > associated to the aforementioned view does not give me a DateTime widget in > the form. > > What is t

DateTime widget in default CreateView form

2021-10-07 Thread Anil Felipe Duggirala
hello, I have tried to find an answer to this question online, with no clear response. I have created a simple class based CreateView for a model that has a DateTime attribute. Simply rendering the form using the {{ form.as_p }} tag in the template associated to the aforementioned view does not

Re: DateField is a string in model instance instead of datetime object

2021-08-29 Thread Sebastian Jung
ehaviour i would expect. Regards 1oglop1 <1ogl...@gmail.com> schrieb am So., 29. Aug. 2021, 17:22: > Hello, > I have a problem that DateField or DateTime fields are `str` instead of > datetime objects after the model has been instantiated/created. > > But when the model is ret

DateField is a string in model instance instead of datetime object

2021-08-29 Thread 1oglop1
Hello, I have a problem that DateField or DateTime fields are `str` instead of datetime objects after the model has been instantiated/created. But when the model is returned from the database it is a correct object. How can I prevent this? given: ``` class My(models.Model): dt_obj

REST framework API through Object of type datetime is not JSON serializable error with auth.backends.RemoteUserBackend

2020-11-12 Thread 'bala' via Django users
;TypeError: Object of type datetime is not JSON serializable To test using the following simple code, once we disable  auth.backends.RemoteUserBackend it works class ApplicationHandler(APIView):    def get(self, request):         usernames = [user.username for user in User.objects.all()]         retur

Re: Get datetime now, not at server initialisation

2020-11-01 Thread Clive Bruton
On 30 Oct 2020, at 11:00, Carles Pina i Estany wrote: Let me know if it's not clear or if I explained something that you didn't ask! Thanks you very much for spending the time on this, to explain it to me - it was very helpful! -- Clive -- You received this message because you are subs

Re: Get datetime now, not at server initialisation

2020-10-30 Thread Carles Pina i Estany
Hi Clive, On Oct/28/2020, Clive Bruton wrote: > Thanks, that was very helpful. I had another pointer on this and found out > that the easiest way to do this is just to change the ```file``` line in the > class to: > > ``` > file = ImageField(_('image'), upload_to='images/items/%Y/%m/%d/%H/%

Re: Get datetime now, not at server initialisation

2020-10-28 Thread Clive Bruton
he current date to set up a file path for uploaded images: def upload_path(): [...] class Image(models.Model): item = models.ForeignKey(Item, on_delete=models.CASCADE) #file = ImageField(_('image'), upload_to='images') file = Image

Re: Get datetime now, not at server initialisation

2020-10-28 Thread Carles Pina i Estany
on_delete=models.CASCADE) > #file = ImageField(_('image'), upload_to='images') > file = ImageField(_('image'), upload_to=upload_path()) > The problem is that when the Image class calls 'upload_path' the > datetime portion of this is always the

Get datetime now, not at server initialisation

2020-10-27 Thread Clive Bruton
load_path()) The problem is that when the Image class calls 'upload_path' the datetime portion of this is always the runserver initialisation time, rather than the time when 'upload_path' is called/used. How to fix this? Thanks -- Clive -- Y

Datetime Error

2020-05-26 Thread HJ
hello django-users hope you are doing well ! I was trying to convert the Date from string to timestamp def JsonDeliv(request): dataset = DeliveriesperDate.objects.all().values_list('Date', 'CountDeliveries') data = list(dataset) for i in data : data[i][0] = int(time.mktime(time.strpti

Re: DateTime

2020-04-28 Thread Kushal Neupane
Thank you sir On Tue, Apr 28, 2020, 17:10 Kasper Laudrup wrote: > Hi Kushal, > > On 28/04/2020 03.39, Kushal Neupane wrote: > > How to make date time as per my region? > > > > This might be helpful: > > > https://howchoo.com/g/ywi5m2vkodk/working-with-date

Re: DateTime

2020-04-28 Thread Kasper Laudrup
Hi Kushal, On 28/04/2020 03.39, Kushal Neupane wrote: How to make date time as per my region? This might be helpful: https://howchoo.com/g/ywi5m2vkodk/working-with-datetime-objects-and-timezones-in-python#enter-timezones Kind regards, Kasper Laudrup -- You received this message because

DateTime

2020-04-27 Thread Kushal Neupane
How to make date time as per my region? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To view this discussion on the

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-09 Thread bhushan Gupta
Hello Kasper, thanks for following up. I installed Datetime module using pip. The module is there but still the same error. Looks like a setup error. Here is the pip output: asgiref==3.2.3 DateTime==4.3 Django==3.0.1 pytz==2019.3 pywin32==227 sqlparse==0.3.0 virtualenv==16.7.8 zope.interface

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-06 Thread Mohamed A
Can you please check whether the python interpreter inside the virtual environment is python 2 or python 3 ? In order to do so, you need to goto to the virtualenv folder, activate cargo env, and then check "python -V" On Mon, Jan 6, 2020 at 7:10 PM Kasper Laudrup wrote: > Hi Bhushan, > > On 06/0

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-06 Thread Kasper Laudrup
Hi Bhushan, On 06/01/2020 18.20, Bhushan Gupta wrote: Recreated virtual environment – no change. Inside your virtual environment, what's the output of: # pip freeze ? Kind regards, Kasper Laudrup -- You received this message because you are subscribed to the Google Groups "Django users"

RE: ModuleNotFoundError: No module named 'datetime'

2020-01-06 Thread Bhushan Gupta
: django-users@googlegroups.com Subject: Re: ModuleNotFoundError: No module named 'datetime' How about deleting your virtualenv and recreating a new one. It may be located here ::: C:\Users\\.virtualenvs\cargo When reactivated, could you please provide as with the results of "ec

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread Mohamed A
...@gmail.com> wrote: > You do not have datetime module installed on your virtual environment. > > To install, type this command: "pip install datetime" > > On Fri, Jan 3, 2020, 18:37 bhushan Gupta wrote: > >> I want to use Django to build a simple portal. I hav

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread sanusi ibrahim adekunle
You do not have datetime module installed on your virtual environment. To install, type this command: "pip install datetime" On Fri, Jan 3, 2020, 18:37 bhushan Gupta wrote: > I want to use Django to build a simple portal. I have done the following > on Windows 10 > installed

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread bhushan Gupta
> from django.utils.version import get_version > File > "c:\users\guptac~1\envs\cargo\lib\site-packages\django\utils\version.py", > line 1, in > import datetime > ModuleNotFoundError: No module named 'datetime' > > I commented out "impo

Re: ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread Daniel Roseman
from django.utils.version import get_version > File > "c:\users\guptac~1\envs\cargo\lib\site-packages\django\utils\version.py", > line 1, in > import datetime > ModuleNotFoundError: No module named 'datetime' > > I commented out "import datetime&

ModuleNotFoundError: No module named 'datetime'

2020-01-03 Thread bhushan Gupta
le "c:\users\guptac~1\envs\cargo\lib\site-packages\django\__init__.py", line 1, in from django.utils.version import get_version File "c:\users\guptac~1\envs\cargo\lib\site-packages\django\utils\version.py", line 1, in import datetime ModuleNotFoundError: No mo

inserting data in a DateTimeField() in Django by using datetime-local

2018-12-07 Thread Godson Rapture
Please, I am creating a to-do list app as my first django project. My form is not valid because I am trying to insert DateTimeField in django using datetime-local. I did research, I discovered I need to do a custom model so I parse the datetime-local field. Pls guide me on how to create a

Re: How to get datetime from server

2018-09-06 Thread ireoluwa fakeye
It's better you import from django.util On Thu, 6 Sep 2018, 17:08 Thiago Luiz Parolin, wrote: > Hi, > I am building a django system that prevent user from upload a file after a > date. > This date is setting using: > today = datetime.date.today() > > but if the user alters his computer date, he

How to get datetime from server

2018-09-06 Thread Thiago Luiz Parolin
Hi, I am building a django system that prevent user from upload a file after a date. This date is setting using: today = datetime.date.today() but if the user alters his computer date, he can upload file normally after the end date. how can i assing to 'today', the date from server and not client

Re: How to get datetime from server

2018-09-06 Thread Thiago Luiz Parolin
Sorry, my mistake! In manage.py runserver, the server is my computer and the time displayed is my computer time. Putting the code in production server all work as expected! Em qui, 6 de set de 2018 às 10:29, Thiago Luiz Parolin < thiago.paro...@unesp.br> escreveu: > Hi, > I am building a django

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Mayank Rungta
scribes the fields I want to >> have a date time picker >> >> So in application/forms.py >> >> >> # >> >> # DJANGO Libraries >> >> # >> >> from django.forms import ModelForm >> >> from django import forms >>

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
-- > > In “templates/application/appCreate.html” I have the follow. The > src=”/media/...” is referencing directory ~/dev/izbo/media > > > {% extends 'base.html' %} > > > {% block css %} > > media="screen" /> > >

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-19 Thread Nate Granatir
other fields > > class Meta : > >model = App > > > > > In “templates/application/appCreate.html” I have the follow. The > src=”/media/...” is referencing directory ~/dev/izbo/media > > > {% extends 'base.html' %} > > >

Re: Newbie to Novice – Using Admin DateTime Picker in your Form

2016-09-18 Thread Mayank Rungta
application/appCreate.html” I have the follow. The > src=”/media/...” is referencing directory ~/dev/izbo/media > > > {% extends 'base.html' %} > > > {% block css %} > > media="screen" /> > > * * > > * * > > src="/media/admin/

Re: Django form Datetime field valid error after add django.middleware.locale.LocaleMiddleware'

2016-09-06 Thread 广宏伟
Resloved, datetime format issue, More see stackoverflow 在 2016年9月5日星期一 UTC+8上午12:15:35,广宏伟写道: > > I use django version 1.10, When a add LocaleMiddleware into settings.py, > form valid error. I have been makemessage and compile it > > Here is my model and form, > > > &

Django form Datetime field valid error after add django.middleware.locale.LocaleMiddleware'

2016-09-04 Thread 广宏伟
SessionMiddleware', 'django.middleware.common.CommonMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.loc

Is it possible to the ReportLab applying the Django utils function's "localtime" to an all date/datetime objects?

2016-07-22 Thread Seti Volkylany
The ReportLab does not have a support for a current timezone, as usual internal Django`s objects. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+u

How reconcile date/datetime`s formats the Python and the Django?

2016-07-22 Thread Seti Volkylany
The Python has next formaters for a date/datetime objects https://docs.python.org/3.0/library/datetime.html#id1 The Django has next - https://docs.djangoproject.com/en/1.9/ref/templates/builtins/#date. As you can see it has many differences and it is a problem. Question is next. How to

Re: Possible bug in Django Admin site in tabular inline or stacked inline with datetime shortcuts

2016-04-25 Thread Константин Попов
I have found possible bug in django admin site, using tabular inline with > datetime field. The same bug exists in stacked inline as I can see form > code. > > I am not sure what is the best way to report the bug, so I decided to > write here first. > Please, give me advice on my

Fractional datetime support

2016-04-24 Thread Charles Gargent
Hi I am running Django v1.9.5 with MariaDB v10.1.13 and I am trying to get fractional seconds working. I have created a field in my model using the following: class History(models.Model): date = models.DateTimeField(null=True) then in the shell I have populated one row using the followin

Possible bug in Django Admin site in tabular inline or stacked inline with datetime shortcuts

2016-04-19 Thread Константин Попов
Hi, django users. I have found possible bug in django admin site, using tabular inline with datetime field. The same bug exists in stacked inline as I can see form code. I am not sure what is the best way to report the bug, so I decided to write here first. Please, give me advice on my next

return objects with datetime field with default_timezone

2016-03-29 Thread Charles Sartori
I am using USE_TZ = True and TIME_ZONE = 'America/Sao_Paulo' when I save some datetime field it will save on MySQL in UTC as expected, but when I query this object and print object.date it still in UTC, I tried to set timezone.activate(timezone.get_default_timezone()) before queryi

Re: Help me! Error in Django. Migrate mysql, datetime and more.

2016-03-28 Thread James Schneider
> > > *problem one : the databases backend does not accept 0 as a ' valueError: > The databases backend does not accept 0 as value for AutoField.* > *problem two: TypeError: int() argument must be a string or a number, not > 'datetime.datetime'* > > When or where do you get these errors? The models

Help me! Error in Django. Migrate mysql, datetime and more.

2016-03-28 Thread Ricardo Felipe Ríos Higueras
groups.google.com/d/optout. # -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.contrib import admin from django.contrib import * from tinymce import models as tinymce_models from PIL import Image from django.contrib.auth.models import User import

Re: null datetime field and json fixtures

2016-02-25 Thread Malik Rumi
This will probably be very helpful. Thanks. On Wed, Feb 24, 2016 at 3:39 PM, James Schneider wrote: > > > On Wed, Feb 24, 2016 at 11:26 AM, Malik Rumi > wrote: > >> I am pursuing the debug option now to see what I can learn. >> >> >> > > Have you looked at enabling tracebacks (--traceback) and

Re: null datetime field and json fixtures

2016-02-24 Thread James Schneider
On Wed, Feb 24, 2016 at 11:26 AM, Malik Rumi wrote: > I am pursuing the debug option now to see what I can learn. > > > Have you looked at enabling tracebacks (--traceback) and increasing the verbosity of the loaddata command (-v {0,1,2,3}, --verbosity {0,1,2,3})? $ python manage.py help loadda

Re: null datetime field and json fixtures

2016-02-24 Thread Malik Rumi
I am pursuing the debug option now to see what I can learn. On Fri, Feb 19, 2016 at 5:29 PM, Michal Petrucha < michal.petru...@konk.org> wrote: > On Fri, Feb 19, 2016 at 10:20:42AM -0600, Malik Rumi wrote: > > In [1]: import uuid > > > > In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74

Re: null datetime field and json fixtures

2016-02-24 Thread Malik Rumi
Sorry to have dropped out for a few days there. James, when I said I only have this one I should clarify. I had 90 records I wanted to put into one model, and 1 record to put into another. The 1 record is linked to by a fk from the other 90. For whatever reason, I was able to put the single record

Re: null datetime field and json fixtures

2016-02-19 Thread Michal Petrucha
On Fri, Feb 19, 2016 at 10:20:42AM -0600, Malik Rumi wrote: > In [1]: import uuid > > In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74') > Out[2]: UUID('61877565-5fe5-4175-9f2b-d24704df0b74') > > BUT > > In [3]: uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74') >

Re: null datetime field and json fixtures

2016-02-19 Thread James Schneider
> > The only uuid currently in this fixture is the one I got from Django when > I put another model (only one row) in with a fixture (no date field) and it > worked. I needed the uuid of that object to put into the foreign key of the > model I am having trouble with now. > > > So I was sniffing aro

Re: null datetime field and json fixtures

2016-02-19 Thread Malik Rumi
In [1]: import uuid In [2]: uuid.UUID('61877565-5fe5-4175-9f2b-d24704df0b74') Out[2]: UUID('61877565-5fe5-4175-9f2b-d24704df0b74') BUT In [3]: uuid.UUID4('61877565-5fe5-4175-9f2b-d24704df0b74') --- AttributeError

Re: null datetime field and json fixtures

2016-02-18 Thread James Schneider
On Thu, Feb 18, 2016 at 8:20 AM, Malik Rumi wrote: > James, > > I used csvkit csvkit.readthedocs.org/en/latest/index.html to convert the > csv to json. > Looks legit. I'll just assume it creates syntactically correct JSON, otherwise it probably wouldn't last long as a public package. > > On We

Re: null datetime field and json fixtures

2016-02-18 Thread Malik Rumi
UPDATE: I went back and looked at the Python module documentation you referenced again. Although it is true that the examples at the top of the page don't strictly match the 8-4-4-4-12 format, those at the bottom of the page do. Furthermore, it seems clear that the uuid.UUID() function is a Pyth

Re: null datetime field and json fixtures

2016-02-18 Thread Michal Petrucha
On Thu, Feb 18, 2016 at 08:20:57AM -0800, Malik Rumi wrote: > James, > > I used csvkit csvkit.readthedocs.org/en/latest/index.html to convert the > csv to json. > > On Wednesday, February 17, 2016 at 7:05:59 PM UTC-6, James Schneider wrote: > > > > > >> The uuid.UUID() function is somewhat forgi

Re: null datetime field and json fixtures

2016-02-18 Thread Malik Rumi
James, I used csvkit csvkit.readthedocs.org/en/latest/index.html to convert the csv to json. On Wednesday, February 17, 2016 at 7:05:59 PM UTC-6, James Schneider wrote: > > >> The uuid.UUID() function is somewhat forgiving when it comes to providing > values. See https://docs.python.org/3.5/lib

Re: null datetime field and json fixtures

2016-02-17 Thread James Schneider
> > > Last night before posting I hacked serializers/python.py to make an > exception for sunsetdate, and that apparently worked, but now I have this: > Yeah...don't do that. Fix your data. > File > "/home/malikarumi/Projects/cannon/local/lib/python2.7/site-packages/django/db/models/fields/__ini

Re: null datetime field and json fixtures

2016-02-17 Thread Malik Rumi
ook and try again. The uuid error seems to be something else. There is a bugfix on github from November of 2014, so I don't (yet) know why I'm having this issue. I may post that later as a separate question. Thanks again! On Wed, Feb 17, 2016 at 3:51 AM, James Schneider wrote: > > &

Re: null datetime field and json fixtures

2016-02-17 Thread James Schneider
On Tue, Feb 16, 2016 at 4:35 PM, Malik Rumi wrote: > There are a ton of answers to this question out there - if you can wade > through all the ones that refer to forms and not models. The consensus > seems to be that datetime has to be set to both blank=true and null=true. > And w

Re: null datetime field and json fixtures

2016-02-17 Thread Avraham Serour
o be that datetime has to be set to both blank=true and null=true. > And when I put in one test row of data manually through the admin, I could > leave my datetime field blank with no problems. But when I tried to load > the 89 other instances through a fixture, I got error after error. &g

null datetime field and json fixtures

2016-02-16 Thread Malik Rumi
There are a ton of answers to this question out there - if you can wade through all the ones that refer to forms and not models. The consensus seems to be that datetime has to be set to both blank=true and null=true. And when I put in one test row of data manually through the admin, I could

Django admin does not show value of datetime field till seconds/miliseconds

2015-05-01 Thread Ankit Agrawal
<https://lh3.googleusercontent.com/-pvlYvK9UuGU/VUOhu3jbPBI/Acs/KE1E3lvsJjM/s1600/Selection_040.png> Hi everyone, I have a model which has a datetime field. In the django admin, the value is shown only till minutes. How can it be configured to display the value in second/mili

django-xadmin datetime widgets not working?

2015-04-21 Thread Christian Schulz
Hi there, I have datetime fields (mysql) with NULL values and in django with models.DateTimeField(blank=True,null=True). It's something like "valid_from" and "valid_to" and I use it as a condition if valid_to is NULL. Existing values are showed correctly , I can

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
> > > But based on your traceback, it seems like at some point in the past > when you made a migration, the field might have had a default value > which was a naive datetime. Is that possible? > > It might be necessary to look through your existing migrations for th

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Carl Meyer
#x27;t actually want a default (it won't have any effect). But based on your traceback, it seems like at some point in the past when you made a migration, the field might have had a default value which was a naive datetime. Is that possible? It might be necessary to look through your existing migrations for this app to find the culprit. Carl signature.asc Description: OpenPGP digital signature

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
On Wednesday, 19 November 2014 15:11:27 UTC, Carl Meyer wrote: > > Hi Daniel, > > On 11/19/2014 08:07 AM, Daniel Grace wrote: > > I have already installed pytz (2014.17) and I have set USE_TZ=True. I > > don't use any naive datetimes in my application. This error is caused > > by something th

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Carl Meyer
Hi Daniel, On 11/19/2014 08:07 AM, Daniel Grace wrote: > I have already installed pytz (2014.17) and I have set USE_TZ=True. I > don't use any naive datetimes in my application. This error is caused > by something that the Django test command is doing automatically, if you > look at the tracebac

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
I have already installed pytz (2014.17) and I have set USE_TZ=True. I don't use any naive datetimes in my application. This error is caused by something that the Django test command is doing automatically, if you look at the traceback you will see that it is something to do with migrations.

Re: What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Russell Keith-Magee
Hi Daniel, A naïve datetime is a datetime that doesn't have a timezone. If you have USE_TZ=True enabled in your settings file (which is the default for new projects), Django expects you to fully specify datetime objects with a timezone; if you don't, you get the warning you've se

What on earth is causing this "naive datetime" warning?

2014-11-19 Thread Daniel Grace
=True) version = models.IntegerField() def __str__(self): return str(self.id) Here is my test.py file: import warnings warnings.filterwarnings( 'error', r"DateTimeField .* received a naive datetime", RuntimeWarning, r'django\.db\.models\.fields'

Re: Runtime warning about a naive datetime when running the test command

2014-11-17 Thread Daniel Grace
On Monday, 17 November 2014 11:33:40 UTC, Bruno Barcarol Guimarães wrote: > > > $ python -W error manage.py test > > Hi Bruno, I get another warning / error with that command: >python -W error manage.py test flow Traceback (most recent call last): File "manage.py", line 8, in from django.c

Re: Runtime warning about a naive datetime when running the test command

2014-11-17 Thread André Castilho Manzano
PS: I also noticed that you have "auto_now_add=True", so you probably using naive date when using filter, or something like that. I hope it's from any help. On 17 November 2014 09:33, Bruno Barcarol Guimarães wrote: > Hi Daniel. > > The problem is you're prob

Re: Runtime warning about a naive datetime when running the test command

2014-11-17 Thread Bruno Barcarol Guimarães
Hi Daniel. The problem is you're probably generating a naive datetime at some point in your code. The best way to solve this is to run the tests with $ python -W error manage.py test That way an exception will be raised instead of a warning. From there you can probably figure out where

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
Is this a bug in the Django tester? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email

Re: Runtime warning about a naive datetime when running the test command

2014-11-16 Thread Daniel Grace
I understand the problem. Why doesn't the Django tester provide time zone aware date times? I know if I set "USE_TZ = False" the warnings will disappear. I was looking for another solution. Could I conditionally set "USE_TZ = False" only when testing? -- You received this message because y

Re: Runtime warning about a naive datetime when running the test command

2014-11-15 Thread André Castilho Manzano
be used in another country (different timezone) you could disable it. On 15 Nov 2014 12:22, "Daniel Grace" wrote: > Hi, > I get a runtime warning about a naive datetime when running the test > command: > >python manage.py test flow > > Creating test database for alias

Re: Runtime warning about a naive datetime when running the test command

2014-11-15 Thread Aliane Abdelouahab
i think it is the same problem here (which has the solution) http://stackoverflow.com/a/20106079/861487 Le samedi 15 novembre 2014 15:22:18 UTC+1, Daniel Grace a écrit : > > Hi, > I get a runtime warning about a naive datetime when running the test > command: > >python m

Runtime warning about a naive datetime when running the test command

2014-11-15 Thread Daniel Grace
Hi, I get a runtime warning about a naive datetime when running the test command: >python manage.py test flow Creating test database for alias 'default'... C:\landy\lib\site-packages\django\db\models\fields\__init__.py:1278: RuntimeWarn ing: DateTimeField Flow.created received a n

Re: Naive datetime / time zone warning

2014-10-13 Thread Daniel Grace
I used "auto_now_add=True" in the model and the warning went away. -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To

Re: Naive datetime / time zone warning

2014-10-13 Thread Daniel Grace
I changed "datetime.now" to "timezone.now" and I get the exact same warning. What is going on? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+uns

Re: Naive datetime / time zone warning

2014-10-13 Thread Carl Meyer
str__(self): > return str(self.id) > > I am getting warnings about time zone support such as the following: > > C:\landy\lib\site-packages\django\db\models\fields\__init__.py:1278: > RuntimeWarning: DateTimeField Flow.modified received a naive datetime > (2014-10-13 17:31:17

Naive datetime / time zone warning

2014-10-13 Thread Daniel Grace
the following: C:\landy\lib\site-packages\django\db\models\fields\__init__.py:1278: RuntimeWarning: DateTimeField Flow.modified received a naive datetime (2014-10-13 17:31:17.510556) while time zone support is active. RuntimeWarning) I have the following line in my settings file: USE_TZ = True

Re: Django datetime localisation by user session

2014-09-17 Thread Collin Anderson
Yes, I'd use the *_INPUT_FORMATS settings for this. The first format in the list is how it will be displayed in the admin, though anything in the list is acceptable. You _may_ need to turn off USE_L10N. not sure. -- You received this message because you are subscribed to the Google Groups "Dja

Django datetime localisation by user session

2014-09-17 Thread Philip Goh
Hello, I'm trying to localise the date time format in my product so that it appears in the UK format of DD/MM/ HH:MM by default unless the user explicitly changes it to the US format of MM/DD/ HH:MM. I've got a number of modal forms that contain a `DateTimeField` and I've overridden th

Re: RuntimeWarning: DateTimeField Task.start received a naive datetime (2014-07-21 07:39:14) while time zone support is active. RuntimeWarning)

2014-07-12 Thread Tom Evans
; tarefa.save() > > Terminal: > > RuntimeWarning: DateTimeField Task.start received a naive datetime > (2014-07-21 07:39:14) while time zone support is active. > > RuntimeWarning) > > > What is it? Any solution? > Somewhere you are producing a naive datetime

  1   2   3   4   5   >