Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $(".field-current").live("click",function(){
- $action = $($(this).children()[0])
- current_state = $action.is(':checked');
- $('.field-current').each(function(index) {
- var $temp = $($(this).children()[0])
- $temp.val(false);
- $temp.attr('checked', false);
- });
- var $current = $($(this).children()[0])
- if (current_state == "on" || current_state == true){
- $current.val(true);
- $current.attr('checked', true);
- }else{
- $current.val(false);
- $current.attr('checked', false);
- }
- });
- });
- class ArticleDetailsInlineAdmin(admin.TabularInline):
- ....
- fields = ['current', 'slug','summary','mod_date']
- class ArticleHeaderAdmin(admin.ModelAdmin):
- inlines = [ArticleDetailsInlineAdmin,]
- ......
- form = ArticleForm
- class Media:
- js = ('js/admin-current-article.js')
- from django.forms.widgets import RadioSelect
- class ArticleDetailsInlineAdmin(admin.TabularInline):
- ...
- fields = ['current', 'slug', 'summary', 'mod_date']
- formfield_overrides = {
- models.BooleanField: {'widget': RadioSelect},
- }
Add Comment
Please, Sign In to add comment