From 58e4e611e25aeffcf67b6444a7c1aea92e2d133c Mon Sep 17 00:00:00 2001 From: Roberto Rosario Date: Thu, 14 Apr 2011 23:05:57 -0400 Subject: [PATCH] Implemented detail form readonly fields the correct way, this fixes copy & paste issues with Firefox --- apps/common/forms.py | 3 +++ apps/common/templates/generic_detail.html | 10 ---------- apps/common/templates/generic_detail_subtemplate.html | 10 ---------- 3 files changed, 3 insertions(+), 20 deletions(-) diff --git a/apps/common/forms.py b/apps/common/forms.py index 7b245fd576..81d7468d1e 100644 --- a/apps/common/forms.py +++ b/apps/common/forms.py @@ -86,6 +86,9 @@ class DetailForm(forms.ModelForm): queryset=getattr(field, 'queryset', None), ) self.fields[field_name].help_text = '' + + for field_name, field in self.fields.items(): + self.fields[field_name].widget.attrs.update({'readonly': 'readonly'}) class GenericConfirmForm(forms.Form): diff --git a/apps/common/templates/generic_detail.html b/apps/common/templates/generic_detail.html index 2983ff83e1..a937c48360 100644 --- a/apps/common/templates/generic_detail.html +++ b/apps/common/templates/generic_detail.html @@ -3,16 +3,6 @@ {% block title %} :: {% with "true" as read_only %}{% with "true" as striptags %}{% include "calculate_form_title.html" %}{% endwith %}{% endwith %}{% endblock %} -{% block javascript %} - -{% endblock %} - {% block sidebar %} {% for subtemplate in sidebar_subtemplates %}
diff --git a/apps/common/templates/generic_detail_subtemplate.html b/apps/common/templates/generic_detail_subtemplate.html index 4db34110a5..aae27f1983 100644 --- a/apps/common/templates/generic_detail_subtemplate.html +++ b/apps/common/templates/generic_detail_subtemplate.html @@ -1,15 +1,5 @@ {% load i18n %} -{% block javascript %} - -{% endblock %} - {% block stylesheets %}