File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import json
2+ from importlib import import_module
23from django .contrib import admin
34from django .contrib .admin .options import TO_FIELD_VAR
45from django .template .response import TemplateResponse
5- from .settings import STREAMBLOCKS_MODELS
6+ from django .conf import settings
7+
8+ STREAMBLOCKS_APP_PATH = getattr (settings , "STREAMFIELD_STREAMBLOCKS_APP_PATH" , "streamblocks" )
9+ try :
10+ streamblocks_app = import_module ("%s.models" % STREAMBLOCKS_APP_PATH )
11+ STREAMBLOCKS_MODELS = streamblocks_app .STREAMBLOCKS_MODELS
12+ except (AttributeError , ValueError ) as e :
13+ raise Exception ("""Can't find STREAMBLOCKS_MODELS: wrong "STREAMFIELD_STREAMBLOCKS_APP_PATH" or STREAMBLOCKS_MODELS don't exist.""" )
614
715class StreamBlocksAdmin (admin .ModelAdmin ):
816 change_form_template = 'streamfield/admin/change_form.html'
Original file line number Diff line number Diff line change 22from django .contrib .admin import ModelAdmin , site
33from django .forms import ModelForm
44from django .utils .functional import cached_property
5+ from django .utils .html import format_html_join
56from django .template import loader
67from django .utils .safestring import mark_safe
78
Original file line number Diff line number Diff line change 33from django .conf import settings
44
55BLOCK_OPTIONS = getattr (settings , "STREAMFIELD_BLOCK_OPTIONS" , {})
6- STREAMBLOCKS_APP_PATH = getattr (settings , "STREAMFIELD_STREAMBLOCKS_APP_PATH" , "streamblocks" )
7-
8- try :
9- streamblocks_app = import_module ("%s.models" % STREAMBLOCKS_APP_PATH )
10- STREAMBLOCKS_MODELS = streamblocks_app .STREAMBLOCKS_MODELS
11- except (AttributeError , ValueError ) as e :
12- raise Exception ("""Can't find STREAMBLOCKS_MODELS: wrong "STREAMFIELD_STREAMBLOCKS_APP_PATH" or STREAMBLOCKS_MODELS don't exist.""" )
Original file line number Diff line number Diff line change 107107 font-weight : bold;
108108}
109109
110+ .streamfield_app .block-fields svg ,
111+ .streamfield_app .block-fields img
112+ {
113+ max-width : 150px ;
114+ max-height : 150px ;
115+ }
116+
110117.streamfield_app .stream-model-subblock {
111118 background : # e0e7eb ;
112119 padding : 10px ;
Original file line number Diff line number Diff line change 1+ from importlib import import_module
12from django .urls import include , path
3+ from django .conf import settings
24
35from . import views
4- from .settings import STREAMBLOCKS_MODELS
6+
7+ STREAMBLOCKS_APP_PATH = getattr (settings , "STREAMFIELD_STREAMBLOCKS_APP_PATH" , "streamblocks" )
8+ try :
9+ streamblocks_app = import_module ("%s.models" % STREAMBLOCKS_APP_PATH )
10+ STREAMBLOCKS_MODELS = streamblocks_app .STREAMBLOCKS_MODELS
11+ except (AttributeError , ValueError ) as e :
12+ raise Exception ("""Can't find STREAMBLOCKS_MODELS: wrong "STREAMFIELD_STREAMBLOCKS_APP_PATH" or STREAMBLOCKS_MODELS don't exist.""" )
513
614admin_instance_urls = []
715
You can’t perform that action at this time.
0 commit comments