django-semantic-admin icon indicating copy to clipboard operation
django-semantic-admin copied to clipboard

How to show date picker (calendar)?

Open Edilton opened this issue 3 years ago • 6 comments

I can't put calendar as example in https://semantic-admin.com at field birthdate. Is necessary an other action ?

Other question, exists suports other languages like Pt-br on calendar?

Edilton avatar Jan 05 '22 19:01 Edilton

Are you using the Django admin? It should be automatic if you inherit from SemanticModelAdmin, or one of the Semantic Inline classes.

As for languages other than English, this is not currently but should be supported. I'll fix it on the weekend to support setting the language, using Django's js translations for Pt-br.

globophobe avatar Jan 05 '22 22:01 globophobe

Are you using the Django admin? It should be automatic if you inherit from SemanticModelAdmin, or one of the Semantic Inline classes. A. Yes, I am using Django Admin. But I not inherit from SemanticModelAdmin, but from Django Default admin. That was the error. Thanks for help me.

As for languages other than English, this is not currently but should be supported. I'll fix it on the weekend to support setting the language, using Django's js translations for Pt-br. A. That is a great news.

Edilton avatar Jan 05 '22 23:01 Edilton

Version 0.2.7 was released with support for translations in the calendar.

You can see it in the demo:

multilingual-calendar

globophobe avatar Jan 09 '22 11:01 globophobe

That's great.

Is it possible edit time config too? I would like to set for dd/mm/YY.

Edilton avatar Jan 11 '22 00:01 Edilton

There is a formatter setting. I published a new release using:

new Intl.DateTimeFormat({ dateStyle: 'short', timeStyle: 'short' }).format(date);

The result:

intl-dateformat

globophobe avatar Jan 12 '22 12:01 globophobe

So, I realized that wasn't your request, and that I hadn't thought it through.

Documentation for the calendar was added.

TLDR

  1. Add the javascript-catalog to url_patterns
  2. Add the SEMANTIC_CALENDAR_OPTIONS, to change the intlDateTimeFormatOptions

globophobe avatar Jan 15 '22 05:01 globophobe

Closing, as I believe the issue was resolved

globophobe avatar Sep 20 '22 13:09 globophobe