Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix datepicker for inline admin #263

Merged

Conversation

mobinghoveoud
Copy link
Contributor

fix #255

Description of Changes

There were two main issues with the datepicker functionality:

  1. Datepicker Executing on Inactive Inputs: In inline admin forms, the datepicker was being executed on inputs that were not yet active (those containing __prefix__ in their IDs).

  2. Reactivating Datepicker After Adding or Removing Formsets: In forms using formsets, when a new form was added or an existing one was removed, the datepicker was not reinitialized for the new inputs.

Also, changes were made to the position and look of the calendar icon and button text to match Django's style.

Testing

I tested these changes in Django versions 4.2 and 5.1. Below are screenshots showing the updated datepicker in both tabular and stacked inline forms.

Tabular Inline

image

Stacked Inline

image

@slashmili slashmili requested a review from hramezani October 22, 2024 06:41
@hramezani
Copy link
Collaborator

@slashmili I am not familiar with ccs and javascript and can't review the code. Based on the screenshots it looks good.

@slashmili
Copy link
Owner

Thanks @mobinghoveoud !

@slashmili slashmili merged commit be8d97d into slashmili:main Oct 22, 2024
15 checks passed
@slashmili
Copy link
Owner

Released as https://pypi.org/project/django-jalali/7.2.0/

@mobinghoveoud mobinghoveoud deleted the fix-datepicker-for-inline-admin branch October 22, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Datepicker doesn't work on admin inlines
3 participants