Put case study editing behind a feature flag
This commit is contained in:
parent
f346356239
commit
0656eee87a
@ -166,6 +166,9 @@ class EditCaseStudy(UserPassesTestMixin, BaseEditForm):
|
||||
form_class = ShortCaseStudyForm
|
||||
|
||||
def test_func(self):
|
||||
if settings.FFCAN_EDIT is False:
|
||||
return False
|
||||
|
||||
object = self.get_object()
|
||||
if object.author:
|
||||
author = object.author.id
|
||||
|
@ -3,6 +3,8 @@ try:
|
||||
except ImportError:
|
||||
from django.core.urlresolvers import reverse
|
||||
|
||||
from django.conf import settings
|
||||
|
||||
from django.views.generic import DetailView, ListView, RedirectView, UpdateView
|
||||
|
||||
from django.contrib.auth.mixins import LoginRequiredMixin
|
||||
@ -28,6 +30,8 @@ class UserDetailView(LoginRequiredMixin, DetailView):
|
||||
case_studies = CaseStudy.objects.filter(author=self.request.user.id)
|
||||
context['case_studies'] = case_studies
|
||||
|
||||
context['enable_edit'] = settings.FF_CAN_EDIT
|
||||
|
||||
return context
|
||||
|
||||
|
||||
|
@ -359,3 +359,6 @@ from django.contrib.messages import constants as messages
|
||||
MESSAGE_TAGS = {
|
||||
messages.ERROR: 'danger'
|
||||
}
|
||||
|
||||
# Feature flags
|
||||
FF_CAN_EDIT = False
|
||||
|
@ -40,8 +40,10 @@
|
||||
<td>{% if case.language %}{{ case.language }}{% else %}-{% endif %}
|
||||
<td>{% if case.approved %}Yes{% else %}No{% endif %}
|
||||
<td>
|
||||
<a href="{% url 'detail' case.slug %}">View</a> |
|
||||
<a href="{% url 'detail' case.slug %}">View</a>
|
||||
{% if enable_edit %} |
|
||||
<a href="{% url 'edit' case.id %}">Edit</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
Reference in New Issue
Block a user