Implemented detail form readonly fields the correct way, this fixes copy & paste issues with Firefox
This commit is contained in:
@@ -86,6 +86,9 @@ class DetailForm(forms.ModelForm):
|
|||||||
queryset=getattr(field, 'queryset', None),
|
queryset=getattr(field, 'queryset', None),
|
||||||
)
|
)
|
||||||
self.fields[field_name].help_text = ''
|
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):
|
class GenericConfirmForm(forms.Form):
|
||||||
|
|||||||
@@ -3,16 +3,6 @@
|
|||||||
|
|
||||||
{% block title %} :: {% with "true" as read_only %}{% with "true" as striptags %}{% include "calculate_form_title.html" %}{% endwith %}{% endwith %}{% endblock %}
|
{% block title %} :: {% with "true" as read_only %}{% with "true" as striptags %}{% include "calculate_form_title.html" %}{% endwith %}{% endwith %}{% endblock %}
|
||||||
|
|
||||||
{% block javascript %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$(".generic_subform form :input").each(function() {
|
|
||||||
this.disabled = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block sidebar %}
|
{% block sidebar %}
|
||||||
{% for subtemplate in sidebar_subtemplates %}
|
{% for subtemplate in sidebar_subtemplates %}
|
||||||
<div class="generic_subform">
|
<div class="generic_subform">
|
||||||
|
|||||||
@@ -1,15 +1,5 @@
|
|||||||
{% load i18n %}
|
{% load i18n %}
|
||||||
|
|
||||||
{% block javascript %}
|
|
||||||
<script type="text/javascript">
|
|
||||||
$(function() {
|
|
||||||
$(".generic_subform form :input").each(function() {
|
|
||||||
this.disabled = true;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
{% block stylesheets %}
|
{% block stylesheets %}
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
#subform form textarea,
|
#subform form textarea,
|
||||||
|
|||||||
Reference in New Issue
Block a user