File tree Expand file tree Collapse file tree
apps/html_template_editor Expand file tree Collapse file tree Original file line number Diff line number Diff line change 55# from django.contrib.auth import get_user_model
66from django .contrib .postgres .fields import JSONField
77from django .db import models
8+ from django .utils .functional import lazy
89from django .utils .html import mark_safe
910from django .utils .translation import ugettext_lazy as _
1011
@@ -166,7 +167,7 @@ class Meta:
166167
167168 icon_name = models .CharField (
168169 verbose_name = _ ("Icon name" ),
169- choices = get_social_media_icons_names (),
170+ choices = (),
170171 max_length = 20 ,
171172 null = True ,
172173 blank = True ,
@@ -177,6 +178,12 @@ class Meta:
177178 blank = True ,
178179 )
179180
181+ def __init__ (self , * args , ** kwargs ):
182+ super ().__init__ (* args , ** kwargs )
183+ self ._meta .get_field ('icon_name' ).choices = lazy (
184+ get_social_media_icons_names ,
185+ )()
186+
180187 def __str__ (self ):
181188 return f'{ self .icon_name } : { self .url } '
182189
You can’t perform that action at this time.
0 commit comments