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

DatePicker widget not showing initial value #138

Open
Seykotron opened this issue Mar 5, 2020 · 3 comments
Open

DatePicker widget not showing initial value #138

Seykotron opened this issue Mar 5, 2020 · 3 comments

Comments

@Seykotron
Copy link

Hi there, its me again!

DatePicker widget is not showing initial value when using it in Filters or in a Form when the form_invalid is raised...

Im trying a lot of things to solve it but nothing seems to work, any clues?

Thank you!!

@Seykotron
Copy link
Author

I Found the solution in templates/windgets/datepicker.html we actually have:

<script>
$(function () {
    $('.datepickerwidget').datepicker({
        autoclose: true
    });
});
</script>

<div class="input-group date">
    <div class="input-group-addon">
        <i class="fa {% if icon %}{{ icon }}{% else %}fa-calendar{% endif %}"></i>
    </div>
    <input type="text" class="{{ class }}" data-date-format="{{ format }}" name="{{ name }}" id="{{ id }}" value="{{ value|date:djformat }}" />
</div>

And now to work its:

<script>
    $(function () {
        $('.datepickerwidget').datepicker({
            autoclose: true
        });
    });
</script>
<div class="input-group date">
    <div class="input-group-addon">
        <i class="fa {% if icon %}{{ icon }}{% else %}fa-calendar{% endif %}"></i>
    </div>
    <input type="text" class="{{ class }}" data-date-format="{{ format }}" name="{{ name }}" id="{{ id }}" value="{{ value }}" />
</div>

And now it works! :)

@oscarmlage
Copy link
Owner

Hey @Seykotron

Cool! Glad to see that it works, maybe if you could send a PR I could merge it to master, what do you think? ;)

@Seykotron
Copy link
Author

Done ;)

I also asked for pull request to implement the icontains into filters fields (CharField, TextField and EmailField), if you remember I told you so time ago but havent time to implement that ;)

Proud to contribute to this great framework ;)

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

No branches or pull requests

2 participants