Closed JanineRoux closed 4 months ago
Not sure if it helps, but you as the error message says, you should set the format in the options like so:
'timestamp': DateTimePickerInput(
options={
# https://getdatepicker.com/4/Options/#format
'format': 'MM/DD/YYYY HH:mm',
# https://getdatepicker.com/4/Options/#stepping
'stepping': 10,
'showClose': True,
'showClear': True
}
)
in your forms widgets. You can see a sample here: https://github.com/christianwgd/date_time_picker_sample
Are you really using two libraries for the datepicker? You're referring to datepicker-plus and datepicker-widget. I don't know, if that is working. One more word on your settings file: There's a comment "get local timezone" which is followed by a statement "local_tz = timezone.now". If you are importing timezone from django.utils timezone.now is a function and timezone.now() will give you the current timezone aware date and time and not a timezone (https://docs.djangoproject.com/en/5.0/topics/i18n/timezones/#naive-and-aware-datetime-objects).
Good morning Christian, Thank you for your speedy response. I have taken your advice, and removed the additional datepicker-widget library, and standardised all my dates on the forms to user the DateTimePickerInput as suggested. The warning has disappeared. I tend to think that the warning may have been linked to an additional attribute on my forms input widget that declared the datetime to be local perhaps? In any event, the clean up standardised all the input date formats, though the one fallout has been that the dark mode is not applied to the datetimepicket widget, which makes them a little unsightly - but that I will address in good time. thanks again Janine
I get this runtime error in my logs :
SatAuthPy3.9\lib\site-packages\bootstrap_datepicker_plus_base.py:38: FutureWarning: The 'format' parameter is ignored, set 'format' in options instead. see https://github.com/monim67/django-bootstrap-datepicker-plus warnings.warn(
I get this runtime message in Dev only (on my hosted prod environment it doesn't seem to appear on startup - but that may be a warning log that is being repressed) Please can you give me more insight into this Future warning - with a view to help me resolve it? I believe it may stem from my django settings.py file (extract attached) - should the formats be attached as widgets on the forms instead of the settings file ?
all my dates and datepickers are currently working fine. (I have over 20 forms and 100 models)
I expect some help pointers in where the adjustments need to be made, extract from my settings.py file
Setup Information (please complete the following information):
OS: Edition Windows 10 Home Single Language Version 22H2 Installed on 2021/04/22 OS build 19045.4291 Experience Windows Feature Experience Pack 1000.19056.1000.0
Browser : Chrome
Browser version : Version 124.0.6367.78
Python version 3.9
Django version 4.2.6
Bootstrap version 5
jQuery version
[x] I have followed the configuration instructions and checked out the common error troubleshooting page.