def __init__(self, *args, **kwargs): kwargs.pop("max_length", "") from widget.widget_pool import get_all_page_widgets super(PageWidgetClassField, self).__init__(*args, **kwargs) choices = get_all_page_widgets() self.choices = choices
def get_widget_list_for_page(page): try: all_classes = get_all_page_widgets() list = Template('widget/list.html') c = {'widgets': all_classes, 'page_id': page.id} return c except Exception: return None
def __init__(self, *args, **kwargs): restrict_list = kwargs.pop("restrict_list", settings.RESTRICTED_WIDGETS) super(WidgetForm, self).__init__(*args, **kwargs) try: user = self.initial["user"] if user.is_superuser: restrict_list = None except KeyError: pass self.uuid = str(uuid4()) self.fields["page"].queryset = Page.objects.get_query_set() self.fields["widget_class"].choices = get_all_page_widgets(restrict_list)
def __init__(self, *args, **kwargs): restrict_list = kwargs.pop("restrict_list", settings.RESTRICTED_WIDGETS) super(WidgetForm, self).__init__(*args, **kwargs) try: user = self.initial["user"] if user.is_superuser: restrict_list = None except KeyError: pass self.uuid = str(uuid4()) self.fields["page"].queryset = Page.objects.get_query_set() self.fields["widget_class"].choices = get_all_page_widgets( restrict_list)
def __init__(self, *args, **kwargs): kwargs["max_length"] = 255 from widget.widget_pool import get_all_page_widgets kwargs["choices"] = get_all_page_widgets() super(PageWidgetClass, self).__init__(*args, **kwargs)
def __init__(self, *args, **kwargs): kwargs.pop('max_length', '') from widget.widget_pool import get_all_page_widgets super(PageWidgetClassField, self).__init__(*args, **kwargs) choices = get_all_page_widgets() self.choices = choices
def __init__(self, *args, **kwargs): kwargs['max_length'] = 255 from widget.widget_pool import get_all_page_widgets kwargs['choices'] = get_all_page_widgets() super(PageWidgetClass, self).__init__(*args, **kwargs)