jazzband / django-push-notifications

Send push notifications to mobile devices through GCM or APNS in Django.
MIT License
2.26k stars 613 forks source link

webpush device admin unsearchable #617

Closed sevdog closed 2 years ago

sevdog commented 3 years ago

Default admin class by default has device_id in search_fields:

https://github.com/jazzband/django-push-notifications/blob/da97ebe8f892a28c9288982ce19713226a6e5d4b/push_notifications/admin.py#L20-L23

However WebPushDevice model does not define any database field this this name, it only defines a property:

https://github.com/jazzband/django-push-notifications/blob/da97ebe8f892a28c9288982ce19713226a6e5d4b/push_notifications/models.py#L250-L252

This causes an interla-server-error when searching on admin

Exception Type: | FieldError
Exception Value | Cannot resolve keyword 'device_id' into field. Choices are: active, application_id, auth, browser, date_created, id, name, p256dh, registration_id, user, user_id

The field should be removed from search field or be added to web push table.

jamaalscarlett commented 2 years ago

@sevdog I just tried this on the latest version, and I am able to search without error. Is this still an issue?

sevdog commented 2 years ago

@jamaalscarlett yes, it works for me too.

Just checked and was fixed in 75f78c0ada99fc76a1412c07eab7245cfaf2d609 (but the commit did not reference this issue).