mirror of
https://github.com/Hopiu/wagtail.git
synced 2026-04-04 15:20:27 +00:00
introduce a common AdminChooser superclass for all our Admin*Choosers
This commit is contained in:
parent
e3216fad45
commit
e8246f6c4b
4 changed files with 10 additions and 18 deletions
|
|
@ -34,8 +34,11 @@ class AdminTagWidget(WidgetWithScript, TagWidget):
|
|||
json.dumps(reverse('wagtailadmin_tag_autocomplete')))
|
||||
|
||||
|
||||
class AdminPageChooser(WidgetWithScript, widgets.Input):
|
||||
class AdminChooser(WidgetWithScript, widgets.Input):
|
||||
input_type = 'hidden'
|
||||
|
||||
|
||||
class AdminPageChooser(AdminChooser):
|
||||
target_content_type = None
|
||||
|
||||
def __init__(self, content_type=None, **kwargs):
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
import json
|
||||
|
||||
from django.forms import widgets
|
||||
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
from wagtail.wagtailadmin.widgets import AdminChooser
|
||||
|
||||
|
||||
class AdminDocumentChooser(WidgetWithScript, widgets.Input):
|
||||
input_type = 'hidden'
|
||||
|
||||
class AdminDocumentChooser(AdminChooser):
|
||||
def render_js_init(self, id_, name, value):
|
||||
return "createDocumentChooser({0});".format(json.dumps(id_))
|
||||
|
|
|
|||
|
|
@ -2,13 +2,9 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
import json
|
||||
|
||||
from django.forms import widgets
|
||||
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
from wagtail.wagtailadmin.widgets import AdminChooser
|
||||
|
||||
|
||||
class AdminImageChooser(WidgetWithScript, widgets.Input):
|
||||
input_type = 'hidden'
|
||||
|
||||
class AdminImageChooser(AdminChooser):
|
||||
def render_js_init(self, id_, name, value):
|
||||
return "createImageChooser({0});".format(json.dumps(id_))
|
||||
|
|
|
|||
|
|
@ -2,13 +2,10 @@ from __future__ import absolute_import, unicode_literals
|
|||
|
||||
import json
|
||||
|
||||
from django.forms import widgets
|
||||
|
||||
from wagtail.utils.widgets import WidgetWithScript
|
||||
from wagtail.wagtailadmin.widgets import AdminChooser
|
||||
|
||||
|
||||
class AdminSnippetChooser(WidgetWithScript, widgets.Input):
|
||||
input_type = 'hidden'
|
||||
class AdminSnippetChooser(AdminChooser):
|
||||
target_content_type = None
|
||||
|
||||
def __init__(self, content_type=None, **kwargs):
|
||||
|
|
|
|||
Loading…
Reference in a new issue