notification: Expand and clarify restriction on id property

- This is to allow arbitrary strings to be part of id property via base32
encoding.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Sunil Mohan Adapa 2020-04-06 20:13:18 -07:00
parent 6216f7872c
commit b3663075a0
No known key found for this signature in database
GPG Key ID: 43EA1CFF0AA7C5F2
2 changed files with 5 additions and 2 deletions

View File

@ -70,7 +70,9 @@ class Notification(models.StoredNotification):
following fields are present in the model:
'id' is a unique string identifier for the notification and acts as the
primary key for the stored database table.
primary key for the stored database table. Only the following chars are
currently allowed: A-Z, a-z, 0-9, - and =. If other chars must be used, it
is recommended to use base32 encoding.
'app_id' is the unique ID of the app showing the notification.
@ -154,6 +156,7 @@ class Notification(models.StoredNotification):
been dismissed by the user.
"""
class Meta: # pylint: disable=too-few-public-methods
"""Meta properties of the Notification model."""
proxy = True

View File

@ -32,6 +32,6 @@ urlpatterns = [
url(r'locked/$', public(CaptchaLoginView.as_view()), name='locked_out'),
# Notifications
url(r'^notification/(?P<id>[a-z0-9-]+)/dismiss/$',
url(r'^notification/(?P<id>[A-Za-z0-9-=]+)/dismiss/$',
views.notification_dismiss, name='notification_dismiss')
]