diff options
-rw-r--r-- | profile/urls.py | 8 | ||||
-rwxr-xr-x | profile/views.py | 2 | ||||
-rw-r--r-- | templates/profile/browse_notifications.html | 14 | ||||
-rwxr-xr-x | urls.py | 2 |
4 files changed, 21 insertions, 5 deletions
diff --git a/profile/urls.py b/profile/urls.py index a577d56..a5e92cd 100644 --- a/profile/urls.py +++ b/profile/urls.py @@ -1,10 +1,12 @@ from django.conf.urls.defaults import * -from pytask.profile.views import view_profile, edit_profile +from pytask.profile.views import view_profile, edit_profile,\ + browse_notifications urlpatterns = patterns('', - (r'view', view_profile), - (r'edit', edit_profile), + (r'^view/$', view_profile), + (r'^edit/$', edit_profile), + (r'^notf/browse/$', browse_notifications), ) diff --git a/profile/views.py b/profile/views.py index 9192180..386ca49 100755 --- a/profile/views.py +++ b/profile/views.py @@ -48,7 +48,7 @@ def browse_notifications(request): """ get the list of notifications that are not deleted and display in datetime order.""" - user = get_user(request.user) + user = request.user active_notifications = user.notification_sent_to.filter(is_deleted=False).order_by('sent_date').reverse() diff --git a/templates/profile/browse_notifications.html b/templates/profile/browse_notifications.html new file mode 100644 index 0000000..8f53278 --- /dev/null +++ b/templates/profile/browse_notifications.html @@ -0,0 +1,14 @@ +{% extends 'base.html' %} +{% block content %} +{% if not notifications %} +You have no notifications. +{% else %} +Notifications for you: <br /> +{% for notification in notifications %} +<a href="/user/notifications/nid={{notification.uniq_key}}"> +{% if not notification.is_read %} <b> {% endif %} +{{notification.sub}} +{% if not notification.is_read %} </b> {% endif %}</a><br /> +{% endfor %} +{% endif %} +{% endblock %} @@ -22,6 +22,6 @@ urlpatterns = patterns('', url(r'^accounts/register/$', register, {'form_class': CustomRegistrationForm}, name='registration_register'), - (r'^accounts/profile/', include('pytask.profile.urls')), (r'^accounts/', include('registration.urls')), + (r'^profile/', include('pytask.profile.urls')), ) |