Fix URL scheme for user pages.
--- a/src/iconolab/templates/iconolab/detail_annotation.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/detail_annotation.html Mon Apr 17 13:31:59 2017 +0200
@@ -33,7 +33,7 @@
</div>
<div v-show="!showZoom" id="detail-annotation" class='col-md-6' style="">
- <h4>Annotation créée par <a href="{% url 'user_home' annotation.author.id %}">{{ annotation.author.username }}</a></h4>
+ <h4>Annotation créée par <a href="{% url 'user_home' annotation.author.username %}">{{ annotation.author.username }}</a></h4>
<p><strong>Titre :</strong> {{ annotation.current_revision.title }}</p>
<p><strong>Description :</strong> {{ annotation.current_revision.description }}</p>
{% if tags_data != "[]" %}
@@ -83,7 +83,7 @@
<p id="c{{comment.id}}-content" class="comment-content">{{ comment.comment }}</p>
<hr class="comment-separator">
{% if comment.allow_thread and user.is_authenticated %}<div class="pull-right"><a class="btn btn-default btn-xs reply-to-btn" id="reply-to-{{comment.id}}" class="comment-reply-link">Répondre</a></div>{% endif %}
- <div id="c{{comment.id}}-subtext" class="comment-subtext">{{ comment.submit_date|date:"d/m/Y" }} à {{ comment.submit_date|time:"H:i" }} - <b><a href="{% url 'user_home' comment.user.id %}">{{comment.name}}</a></b></div>
+ <div id="c{{comment.id}}-subtext" class="comment-subtext">{{ comment.submit_date|date:"d/m/Y" }} à {{ comment.submit_date|time:"H:i" }} - <b><a href="{% url 'user_home' comment.user.username %}">{{comment.name}}</a></b></div>
<div id="c{{comment.id}}-label-list" class="comment-metacategories">
{% if comment.revision or comment.metacategories.count > 0 %} - {% endif %}
{% if comment.revision %}
--- a/src/iconolab/templates/iconolab/detail_annotation_readonly.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/detail_annotation_readonly.html Mon Apr 17 13:31:59 2017 +0200
@@ -31,7 +31,7 @@
</div>
<div v-show="!showZoom" id="detail-annotation" class='col-md-6' style="">
- <h4>Annotation créée par <a href="{% url 'user_home' annotation.author.id %}">{{ annotation.author.username }}</a></h4>
+ <h4>Annotation créée par <a href="{% url 'user_home' annotation.author.username %}">{{ annotation.author.username }}</a></h4>
<p><strong>Titre :</strong> {{ annotation.current_revision.title }}</p>
<p><strong>Description :</strong> {{ annotation.current_revision.description }}</p>
{% if tags_data != "[]" %}
--- a/src/iconolab/templates/iconolab/user_annotations.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_annotations.html Mon Apr 17 13:31:59 2017 +0200
@@ -21,35 +21,35 @@
<ul class="pagination pull-right img-ann-{{image.obj.guid}}-perpage" style="margin-left: 15px;">
<li class="active pagination-label"><a>Annotations par page : </a></li>
<li class="{% if user_annotations.paginator.per_page == 5 %}active{% endif %}">
- <a {% if user_annotations.paginator.per_page != 5 %}href="{% url 'user_annotations' profile_user.id %}?&page=1&perpage=5"{% endif %}>5</a>
+ <a {% if user_annotations.paginator.per_page != 5 %}href="{% url 'user_annotations' profile_user.username %}?&page=1&perpage=5"{% endif %}>5</a>
</li>
<li class="{% if user_annotations.paginator.per_page == 10 %}active{% endif %}">
- <a {% if user_annotations.paginator.per_page != 10 %}href="{% url 'user_annotations' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
+ <a {% if user_annotations.paginator.per_page != 10 %}href="{% url 'user_annotations' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
</li>
<li class="{% if user_annotations.paginator.per_page == 25 %}active{% endif %}">
- <a {% if user_annotations.paginator.per_page != 25 %}href="{% url 'user_annotations' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
+ <a {% if user_annotations.paginator.per_page != 25 %}href="{% url 'user_annotations' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
</li>
<li class="{% if user_annotations.paginator.per_page == 100 %}active{% endif %}">
- <a {% if user_annotations.paginator.per_page != 100 %}href="{% url 'user_annotations' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
+ <a {% if user_annotations.paginator.per_page != 100 %}href="{% url 'user_annotations' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
</li>
</ul>
{% if user_annotations.has_previous or user_annotations.has_next %}
<ul class="pagination pull-right">
{% if user_annotations.has_previous %}
<li>
- <a href="{% url 'user_annotations' profile_user.id %}?page={{user_annotations.previous_page_number}}" aria-label="Précédent">
+ <a href="{% url 'user_annotations' profile_user.username %}?page={{user_annotations.previous_page_number}}" aria-label="Précédent">
<span aria-hidden="true">«</span>
</a>
</li>
{% endif %}
{% for page in user_annotations.paginator.page_range %}
<li id="page-link-{{page}}" class="pagination-link {% if page == user_annotations.number %}active{% endif %}">
- <a {% if page != user_annotations.number %}href="{% url 'user_annotations' profile_user.id %}?page={{page}}&perpage={{user_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
+ <a {% if page != user_annotations.number %}href="{% url 'user_annotations' profile_user.username %}?page={{page}}&perpage={{user_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
</li>
{% endfor %}
{% if user_annotations.has_next %}
<li>
- <a href="{% url 'user_annotations' profile_user.id %}?page={{user_annotations.next_page_number}}" aria-label="Suivant">
+ <a href="{% url 'user_annotations' profile_user.username %}?page={{user_annotations.next_page_number}}" aria-label="Suivant">
<span aria-hidden="true">»</span>
</a>
</li>
--- a/src/iconolab/templates/iconolab/user_base.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_base.html Mon Apr 17 13:31:59 2017 +0200
@@ -9,11 +9,11 @@
<div class="row">
<div class="col-md-3">
<div class="list-group">
- <a href="{% url 'user_home' profile_user.id %}"
+ <a href="{% url 'user_home' profile_user.username %}"
class="list-group-item {% if request.resolver_match.url_name == 'user_home' %}active{% endif%}">
Activité
</a>
- <a href="{% url 'user_annotations' profile_user.id %}"
+ <a href="{% url 'user_annotations' profile_user.username %}"
class="list-group-item {% if request.resolver_match.url_name == 'user_annotations' %}active{% endif%}">
Annotations
</a>
--- a/src/iconolab/templates/iconolab/user_collection_admin.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_collection_admin.html Mon Apr 17 13:31:59 2017 +0200
@@ -9,7 +9,7 @@
{% load notifications_tags %}
{% block content %}
- <div id="user-profile-block" class="row">
+ <div id="user-profile-block">
<h3>Tableau de bord - Fonds {{collection.verbose_name}}</h3>
<h2><small>Filtres et tri</small></h2>
<form class="form" method="GET" target="">
--- a/src/iconolab/templates/iconolab/user_collections.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_collections.html Mon Apr 17 13:31:59 2017 +0200
@@ -5,7 +5,7 @@
{% for collection in profile_user.profile.managed_collections.all %}
<h3>{{collection.verbose_name}}</h3>
<div>
- <a href="{% url 'user_admin_panel' profile_user.id collection.name %}" class="btn btn-default text-center">Tableau de bord</a>
+ <a href="{% url 'user_admin_panel' collection.name %}" class="btn btn-default text-center">Tableau de bord</a>
</div>
{% endfor %}
{% endblock %}
--- a/src/iconolab/templates/iconolab/user_commented.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_commented.html Mon Apr 17 13:31:59 2017 +0200
@@ -9,8 +9,8 @@
{% load notifications_tags %}
{% block content %}
- <div id="user-profile-block" class="row">
- <h3>{{profile_user.username}}: Annotations commentées <a class="btn btn-default" href="{% url 'user_home' profile_user.id %}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> Retour au profil</a></h3>
+ <div id="user-profile-block">
+ <h3>{{profile_user.username}}: Annotations commentées <a class="btn btn-default" href="{% url 'user_home' profile_user.username %}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> Retour au profil</a></h3>
<hr>
{% if not user_commented_annotations %}
<h4 class="no-user-annotation"><small>Aucune annotation à afficher</small></h4>
@@ -23,36 +23,36 @@
<ul class="pagination pull-right img-ann-{{image.obj.guid}}-perpage" style="margin-left: 15px;">
<li class="active pagination-label"><a>Annotations par page : </a></li>
<li class="{% if user_commented_annotations.paginator.per_page == 5 %}active{% endif %}">
- <a {% if user_commented_annotations.paginator.per_page != 5 %}href="{% url 'user_commented' profile_user.id %}?&page=1&perpage=5"{% endif %}>5</a>
+ <a {% if user_commented_annotations.paginator.per_page != 5 %}href="{% url 'user_commented' profile_user.username %}?&page=1&perpage=5"{% endif %}>5</a>
</li>
<li class="{% if user_commented_annotations.paginator.per_page == 10 %}active{% endif %}">
- <a {% if user_commented_annotations.paginator.per_page != 10 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
+ <a {% if user_commented_annotations.paginator.per_page != 10 %}href="{% url 'user_commented' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
</li>
<li class="{% if user_commented_annotations.paginator.per_page == 25 %}active{% endif %}">
- <a {% if user_commented_annotations.paginator.per_page != 25 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
+ <a {% if user_commented_annotations.paginator.per_page != 25 %}href="{% url 'user_commented' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
</li>
<li class="{% if user_commented_annotations.paginator.per_page == 100 %}active{% endif %}">
- <a {% if user_commented_annotations.paginator.per_page != 100 %}href="{% url 'user_commented' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
+ <a {% if user_commented_annotations.paginator.per_page != 100 %}href="{% url 'user_commented' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
</li>
</ul>
{% if user_commented_annotations.has_previous or user_commented_annotations.has_next %}
<ul class="pagination pull-right">
{% if user_commented_annotations.has_previous %}
<li>
- <a href="{% url 'user_commented' profile_user.id %}?page={{user_commented_annotations.previous_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Précédent">
+ <a href="{% url 'user_commented' profile_user.username %}?page={{user_commented_annotations.previous_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Précédent">
<span aria-hidden="true">«</span>
</a>
</li>
{% endif %}
{% for page in user_commented_annotations.paginator.page_range %}
<li id="page-link-{{page}}" class="pagination-link {% if page == user_commented_annotations.number %}active{% endif %}">
- <a {% if page != user_commented_annotations.number %}href="{% url 'user_commented' profile_user.id %}?page={{page}}&perpage={{user_commented_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
+ <a {% if page != user_commented_annotations.number %}href="{% url 'user_commented' profile_user.username %}?page={{page}}&perpage={{user_commented_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
</li>
{% endfor %}
{% if user_commented_annotations.has_next %}
<li>
- <a href="{% url 'user_commented' profile_user.id %}?page={{user_commented_annotations.next_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Suivant">
+ <a href="{% url 'user_commented' profile_user.username %}?page={{user_commented_annotations.next_page_number}}&perpage={{user_commented_annotations.paginator.per_page}}" aria-label="Suivant">
<span aria-hidden="true">»</span>
</a>
</li>
--- a/src/iconolab/templates/iconolab/user_contributed.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_contributed.html Mon Apr 17 13:31:59 2017 +0200
@@ -9,8 +9,8 @@
{% load notifications_tags %}
{% block content %}
- <div id="user-profile-block" class="row">
- <h3>{{profile_user.username}}: Toutes les contributions <a class="btn btn-default" href="{% url 'user_home' profile_user.id %}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> Retour au profil</a></h3>
+ <div id="user-profile-block">
+ <h3>{{profile_user.username}}: Toutes les contributions <a class="btn btn-default" href="{% url 'user_home' profile_user.username %}"><span class="glyphicon glyphicon-share-alt" aria-hidden="true"></span> Retour au profil</a></h3>
<hr>
{% if not user_contributed_annotations %}
<h4 class="no-user-annotation"><small>Aucune annotation à afficher</small></h4>
@@ -23,36 +23,36 @@
<ul class="pagination pull-right img-ann-{{image.obj.guid}}-perpage" style="margin-left: 15px;">
<li class="active pagination-label"><a>Annotations par page : </a></li>
<li class="{% if user_contributed_annotations.paginator.per_page == 5 %}active{% endif %}">
- <a {% if user_contributed_annotations.paginator.per_page != 5 %}href="{% url 'user_contributed' profile_user.id %}?&page=1&perpage=5"{% endif %}>5</a>
+ <a {% if user_contributed_annotations.paginator.per_page != 5 %}href="{% url 'user_contributed' profile_user.username %}?&page=1&perpage=5"{% endif %}>5</a>
</li>
<li class="{% if user_contributed_annotations.paginator.per_page == 10 %}active{% endif %}">
- <a {% if user_contributed_annotations.paginator.per_page != 10 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
+ <a {% if user_contributed_annotations.paginator.per_page != 10 %}href="{% url 'user_contributed' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=10"{% endif %}>10</a>
</li>
<li class="{% if user_contributed_annotations.paginator.per_page == 25 %}active{% endif %}">
- <a {% if user_contributed_annotations.paginator.per_page != 25 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
+ <a {% if user_contributed_annotations.paginator.per_page != 25 %}href="{% url 'user_contributed' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=25"{% endif %}>25</a>
</li>
<li class="{% if user_contributed_annotations.paginator.per_page == 100 %}active{% endif %}">
- <a {% if user_contributed_annotations.paginator.per_page != 100 %}href="{% url 'user_contributed' profile_user.id %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
+ <a {% if user_contributed_annotations.paginator.per_page != 100 %}href="{% url 'user_contributed' profile_user.username %}?show={{image.obj.image_guid}}&page=1&perpage=100"{% endif %}>100</a>
</li>
</ul>
{% if user_contributed_annotations.has_previous or user_contributed_annotations.has_next %}
<ul class="pagination pull-right">
{% if user_contributed_annotations.has_previous %}
<li>
- <a href="{% url 'user_contributed' profile_user.id %}?page={{user_contributed_annotations.previous_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Précédent">
+ <a href="{% url 'user_contributed' profile_user.username %}?page={{user_contributed_annotations.previous_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Précédent">
<span aria-hidden="true">«</span>
</a>
</li>
{% endif %}
{% for page in user_contributed_annotations.paginator.page_range %}
<li id="page-link-{{page}}" class="pagination-link {% if page == user_contributed_annotations.number %}active{% endif %}">
- <a {% if page != user_contributed_annotations.number %}href="{% url 'user_contributed' profile_user.id %}?page={{page}}&perpage={{user_contributed_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
+ <a {% if page != user_contributed_annotations.number %}href="{% url 'user_contributed' profile_user.username %}?page={{page}}&perpage={{user_contributed_annotations.paginator.per_page}}"{% endif %}>{{page}}</a>
</li>
{% endfor %}
{% if user_contributed_annotations.has_next %}
<li>
- <a href="{% url 'user_contributed' profile_user.id %}?page={{user_contributed_annotations.next_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Suivant">
+ <a href="{% url 'user_contributed' profile_user.username %}?page={{user_contributed_annotations.next_page_number}}&perpage={{user_contributed_annotations.paginator.per_page}}" aria-label="Suivant">
<span aria-hidden="true">»</span>
</a>
</li>
--- a/src/iconolab/templates/iconolab/user_home.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/iconolab/user_home.html Mon Apr 17 13:31:59 2017 +0200
@@ -20,7 +20,7 @@
{% include "partials/user_pages/annotations_created_panel.html" with annotation=annotation user=profile_user %}
{% endfor %}
</ul>
- <a class="btn btn-default btn-sm" href="{% url 'user_annotations' profile_user.id %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les annotations</a>
+ <a class="btn btn-default btn-sm" href="{% url 'user_annotations' profile_user.username %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les annotations</a>
{% endif %}
</div>
<div>
@@ -42,7 +42,7 @@
{% include "partials/user_pages/annotations_contributed_panel.html" with annotation_data=annotation_data user=profile_user %}
{% endfor %}
<li>
- <a class="btn btn-default btn-sm" href="{% url 'user_contributed' profile_user.id %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les contributions</a>
+ <a class="btn btn-default btn-sm" href="{% url 'user_contributed' profile_user.username %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les contributions</a>
</li>
</ul>
{% endif %}
@@ -63,7 +63,7 @@
{% include "partials/user_pages/annotations_commented_panel.html" with annotation_data=annotation_data user=profile_user %}
{% endfor %}
<li>
- <a class="btn btn-default btn-sm" href="{% url 'user_commented' profile_user.id %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les annotations commentées</a>
+ <a class="btn btn-default btn-sm" href="{% url 'user_commented' profile_user.username %}"><span class="glyphicon glyphicon-list" aria-hidden="true"></span> Voir toutes les annotations commentées</a>
</li>
</ul>
{% endif %}
--- a/src/iconolab/templates/partials/header.html Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/templates/partials/header.html Mon Apr 17 13:31:59 2017 +0200
@@ -21,7 +21,7 @@
<ul class="nav navbar-nav navbar-right">
{% if request.user.is_authenticated %}
{% notifications_unread as unread_count %}
- <li><a href="{% url 'user_home' request.user.id %}" title="{{request.user.username}}: Mon espace - {{ unread_count }} notification(s)">
+ <li><a href="{% url 'user_home' request.user.username %}" title="{{request.user.username}}: Mon espace - {{ unread_count }} notification(s)">
Mon espace <span class="badge {% if unread_count %}badge-warning{% endif %}">
{{ unread_count }} <i class="fa fa-envelope-o" aria-hidden="true"></i> </span>
</a></li>
--- a/src/iconolab/urls.py Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/urls.py Mon Apr 17 13:31:59 2017 +0200
@@ -45,15 +45,15 @@
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[^/]+)/detail', views.objects.ShowRevisionView.as_view(), name='revision_detail'),
url(r'^collections/(?P<collection_name>[a-z0-9\-]+)/images/(?P<image_guid>[^/]+)/annotations/(?P<annotation_guid>[^/]+)/revisions/(?P<revision_guid>[^/]+)/merge$', login_required(views.objects.MergeProposalView.as_view()), name='annotation_merge'),
- url(r'^user/(?P<slug>[a-z0-9\-]+)/home/?$', views.userpages.UserHomeView.as_view(), name="user_home"),
+ url(r'^user/settings/?$', login_required(views.userpages.UserSettingsView.as_view()), name="user_settings"),
+ url(r'^user/collections/?$', login_required(views.userpages.UserCollectionsView.as_view()), name="user_collections"),
+ url(r'^user/notifications/', include(notifications.urls, namespace='notifications')),
+ url(r'^user/(?P<slug>[a-z0-9\-]+)/?$', views.userpages.UserHomeView.as_view(), name="user_home"),
url(r'^user/(?P<slug>[a-z0-9\-]+)/commented/?$', views.userpages.UserCommentedView.as_view(), name="user_commented"),
url(r'^user/(?P<slug>[a-z0-9\-]+)/contributed/?$', views.userpages.UserContributedView.as_view(), name="user_contributed"),
url(r'^user/(?P<slug>[a-z0-9\-]+)/annotations/?$', views.userpages.UserAnnotationsView.as_view(), name="user_annotations"),
- url(r'^user/(?P<slug>[a-z0-9\-]+)/adminpanel/(?P<collection_name>[a-z0-9\-]+)/$', views.userpages.UserCollectionAdminView.as_view(), name="user_admin_panel"),
+ url(r'^user/adminpanel/(?P<collection_name>[a-z0-9\-]+)/$', views.userpages.UserCollectionAdminView.as_view(), name="user_admin_panel"),
url(r'^user/notifications/all/?$', login_required(views.userpages.UserNotificationsView.as_view()), name="user_notifications"),
- url(r'^user/settings/?$', login_required(views.userpages.UserSettingsView.as_view()), name="user_settings"),
- url(r'^user/collections/?$', login_required(views.userpages.UserCollectionsView.as_view()), name="user_collections"),
- url(r'^user/notifications/', include(notifications.urls, namespace='notifications')),
url(r'^errors/404', views.misc.NotFoundErrorView.as_view(), name="404error"),
--- a/src/iconolab/views/userpages.py Mon Apr 17 12:39:55 2017 +0200
+++ b/src/iconolab/views/userpages.py Mon Apr 17 13:31:59 2017 +0200
@@ -22,7 +22,7 @@
latest annotations commented recap, also provides access to admin interface.
"""
model = User
- slug_field = 'id'
+ slug_field = 'username'
def get_context_data(self, **kwargs):
context = super(UserHomeView, self).get_context_data(**kwargs)
@@ -75,7 +75,7 @@
View that displays the full paginated list of annotations created for the considered user
"""
model = User
- slug_field = 'id'
+ slug_field = 'username'
def get_context_data(self, **kwargs):
context = super(UserAnnotationsView, self).get_context_data(**kwargs)
@@ -109,7 +109,7 @@
View that displays the full paginated list of annotations on which the considered user has commented
"""
model = User
- slug_field = 'id'
+ slug_field = 'username'
def get_context_data(self, **kwargs):
context = super(UserCommentedView, self).get_context_data(**kwargs)
@@ -137,7 +137,7 @@
View that displays the full paginated list of annotations on which the considered user has submitted at least one revision
"""
model = User
- slug_field = 'id'
+ slug_field = 'username'
def get_context_data(self, **kwargs):
context = super(UserContributedView, self).get_context_data(**kwargs)
@@ -160,21 +160,22 @@
context['profile_user'] = profile_user
return render(request, 'iconolab/user_contributed.html', context)
-class UserCollectionAdminView(DetailView):
+class UserCollectionAdminView(View):
"""
View that displays the admin panel, allowing collection admin to filter and order annotations on several criterias
"""
- model = User
- slug_field = 'id'
+ # model = User
+ # slug_field = 'id'
- def get_context_data(self, **kwargs):
- context = super(UserCollectionAdminView, self).get_context_data(**kwargs)
- return context
+ # def get_context_data(self, **kwargs):
+ # context = super(UserCollectionAdminView, self).get_context_data(**kwargs)
+ # return context
def get(self, request, *args, **kwargs):
- self.object = self.get_object()
- profile_user = self.object
- context = self.get_context_data()
+ # self.object = self.get_object()
+ profile_user = request.user
+ # context = self.get_context_data()
+ context = {}
collection_name = kwargs.get("collection_name")
collection_qs = Collection.objects.filter(name=collection_name)
if not request.user.is_staff and not request.user.is_authenticated or profile_user != request.user or not collection_qs.exists():