pass context to overridden templates

23 views
Skip to first unread message

cjdcordeiro

unread,
May 2, 2017, 6:48:42 PM5/2/17
to Django users
Hi guys,

I'm using django-notification-hq, so my app's urls.py has:

...
   url(r'^inbox/', include(notifications.urls, namespace='notifications')),
...


I've modified those default templates but I am unable to pass context to them. 


It isn't old so I'm afraid this is yet not possible? Any workarounds?

Cheers,
Cris

cjdcordeiro

unread,
May 3, 2017, 9:53:48 AM5/3/17
to Django users
Probably the best would be overriding the app's default class based view, but when I look at it (https://github.com/django-notifications/django-notifications/blob/master/notifications/views.py#L29) it doesn't have a get_context method or anything I can play with to change the default context....

ideas? anyone?

Florian Schweikert

unread,
May 4, 2017, 3:52:17 AM5/4/17
to django...@googlegroups.com
On 03/05/17 15:53, cjdcordeiro wrote:
> Probably the best would be overriding the app's default class based
> view, but when I look at it
> (https://github.com/django-notifications/django-notifications/blob/master/notifications/views.py#L29)
> it doesn't have a get_context method or anything I can play with to
> change the default context....
>
> ideas? anyone?

As NotificationViewList is a ListView it should have get_context_data
see:
https://docs.djangoproject.com/en/1.11/ref/class-based-views/generic-display/#listview
Reply all
Reply to author
Forward
0 new messages