We help IT Professionals succeed at work.
Get Started

Make Field Readonly

Ray Zuchowski
on
79 Views
Last Modified: 2019-11-21
I have a field in my database that is displayed on my form in Django that i want to be just readonly. How do i do that ?


Here is my a section of my HTML page.

{% extends 'base.html' %}

{% load crispy_forms_tags %}
{% load static %}
{% block content %}

<br>
<h2>{% load static %}
<img src="{% static 'forms/star.png' %}" alt="chain" height="62" width= "62">  K-8 School Points</h2>
<br>
<br>
<div class = "container">
 <div class= 'row'>
  <div class="col-4"> 
<p> Recording Data as User : {{user.username}} </p>
  </div>
</div>

 <div class= 'row'>
  <div class="col-2"> 
<p>{{form.status|as_crispy_field }}</p>                                <------------This is the field i need to be readonly 
  </div>
</div>
<form method="POST">
    {% csrf_token %}
 <!-- Start Date -->

Open in new window

Comment
Watch Question
IT Director
Commented:
This problem has been solved!
Unlock 1 Answer and 1 Comment.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant

An Experts Exchange subscription includes unlimited access to online courses.

Get Started
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE