i am trying to do user to user message app and i cam across this postman package to help
but it has regex urls patterns that i really didn’t like to use or see in my patterns, but i like to try and learn
re_path(pgettext_lazy('postman_url', r'^view/(?P<message_id>[\d]+)/$'), MessageView.as_view(), name='view'),
here is the view class that is responsible for view the specified message
class MessageView(DisplayMixin, TemplateView):
"""Display one specific message."""
def get(self, request, message_id, *args, **kwargs):
self.filter = Q(pk=message_id)
return super().get(request, *args, **kwargs)
when i try to go to this page using this url in template
<a href="{% url 'postman:view' message.id %}" class="boxed-btn3 w-20">View Message</a>
i got this error
i have tried a lot of different options as message.id or .pk or message_id and all didn’t work
what should i put there to get this view specially when i have another urls that will need the same id or other options
re_path(pgettext_lazy('postman_url', r'^trash/(?:(?P<option>m)/)?$'), TrashView.as_view(), name='trash'),
re_path(pgettext_lazy('postman_url', r'^write/(?:(?P<recipients>[^/#]+)/)?$'), WriteView.as_view(), name='write'),
re_path(pgettext_lazy('postman_url', r'^reply/(?P<message_id>[\d]+)/$'), ReplyView.as_view(), name='reply'),
re_path(pgettext_lazy('postman_url', r'^view/(?P<message_id>[\d]+)/$'), MessageView.as_view(), name='view'),
any idea what should i put in case of message.id, and the others option or for specified message