TrangPham / django-admin-confirm

AdminConfirmMixin is a mixin for ModelAdmin that adds confirmations to changes, additions and actions.
Other
129 stars 16 forks source link

Handling DateTimeField field change option #22

Closed S2606 closed 3 years ago

S2606 commented 3 years ago

So on setting up confirm screen on model change, while changing a DateTime field via the admin, this is the issue I am currently facing.

Screenshot 2021-03-24 at 5 32 17 PM

models.py

class Polls(models.Model):
    poll_name = models.CharField(max_length=200, null=True, blank=True)
    poll_no = models.PositiveIntegerField(null=True, blank=True)
    start_date = models.DateTimeField(null=True, blank=True)

admin.py

@register(Polls)
class PollsAdmin(AdminConfirmMixin, admin.ModelAdmin):
    list_display = ("poll_name", "poll_no")
    search_fields = ("poll_name", )
    confirm_change = True
    confirmation_fields = ['poll_name', 'poll_no', 'start_date']
S2606 commented 3 years ago

Also just found out that datetime fields are not supported I guess by reading testing readme

TrangPham commented 3 years ago

Hi @S2606

What version of django_admin_confirm, python, and django are you using? Could you post the stacktrace for your error?

I tried to replicate the issue and was not able to do so.

Thanks!

S2606 commented 3 years ago

I was trying this on django_admin_confirm version number 0.2.2, python 3.7, django 2.2.5. But just found out that a new version is in pre-release(0.2.3a0). And this issue is not getting reproduced in that version.

TrangPham commented 3 years ago

Yay! Okay awesome. I’m glad. I was starting to add tests for it yesterday.

Let me know if you have any issues with v0.2.3a0 or if you’re using it smoothly. If all goes well, I’ll release the pre-release as stable.

On Thu, Mar 25, 2021 at 21:49 Shagun Khemka @.***> wrote:

I was trying this on django_admin_confirm version number 0.2.2, python 3.7, django 2.2.5. But just found out that a new version is in pre-release(0.2.3a0). And this issue is not getting reproduced in that version.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/TrangPham/django-admin-confirm/issues/22#issuecomment-807932715, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAQE5QJTXF4VV3HFWXB2I3LTFQG6HANCNFSM4ZXD2FCA .

TrangPham commented 3 years ago

Affected Release: v0.2.2 Fixed in: v0.2.3a0