Custom Search

SUBSCRIBE

SUBSCRIBE : 300 + Free Video Tutorials Programming (Python, golang, Julia), DevOps

Wednesday, August 20, 2014

Django ModelAdmin ActionForm action_checkbox

* See django/contrib/admin/options.py and django/contrib/admin/helpers.py

#python manage.py shell
>>>
>>>
>>>
>>> from django import forms
>>>
>>> checkbox = forms.CheckboxInput({'class': 'action-select'}, lambda value: False)
>>>
>>> ACTION_CHECKBOX_NAME = '_selected_action'
>>>
>>>
>>> from django.contrib.admin import helpers
>>>
>>>
>>> from django.utils.encoding import force_text
>>>
>>> c = checkbox.render(ACTION_CHECKBOX_NAME, force_text(4444))
>>>
>>> c
u''
>>>
>>>
>>>







No comments:

Post a Comment