Skip to content

Instantly share code, notes, and snippets.

@howiworkdaily
Created January 23, 2009 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save howiworkdaily/51221 to your computer and use it in GitHub Desktop.
Save howiworkdaily/51221 to your computer and use it in GitHub Desktop.
/*
* Simple code snippet to apply a "* denotes required field" below the Django Admin page title, ex "Change [Model]"
* It also appends a "[field name]*" to all fields that are required.
* And finally it makes all the labels for required fields nice a red.
** Note: make sure to reference jquery in templates/admin/base_site.html <script type="text/javascript" src="{{ STATIC_URL }}js/jquery-latest.pack.js"></script>
*/
$(document).ready(function() {
$('.required').not( $('.inline-related').find('.required') ).append('*').attr("style","color: #FF0000 !important");
$('.change-form > #container > #content > h1').after('<p style="color:#FF0000 !important"><br/>* denotes required fields.</p>');
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment