1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/wuyue92tree-django-adminlte-ui

Присоединиться к Gitlife
Откройте для себя и примите участие в публичных проектах с открытым исходным кодом с участием более 10 миллионов разработчиков. Приватные репозитории также полностью бесплатны :)
Присоединиться бесплатно
Это зеркальный репозиторий, синхронизируется ежедневно с исходного репозитория.
Клонировать/Скачать
guide.md 2.3 КБ
Копировать Редактировать Исходные данные Просмотреть построчно История
伍岳 Отправлено 6 лет назад 065a0a1

Guides

General Option

dynamic setup your site base on table django_admin_settings_options.

support options:

  • Site Title
  • Site Header
  • Site Logo
  • Welcome Sign

Options

this options in your db, named django_admin_settings_options, after do migrate.

you can also add your custom option into this table, and use it by templatetags adminlte_options with function get_adminlte_option.

options table has a valid field to control your option work or not.

example:

# adminlte/general_option.html

{% load adminlte_options %}

# here my option_name is site_title, you can custom yourself.
{% get_adminlte_option 'site_title' as adminlte_site_title %}
{% if adminlte_site_title.valid %}
{{ adminlte_site_title.site_title }}
{% else %}
{{ site_title|default:_('Django site admin') }}
{% endif %}

before custom option, you should known what adminlte has used.

  • site_title
  • site_header
  • site_logo
  • welcome_sign

Widgets

AdminlteSelect

example:

# adminlte/admin.py
@admin.register(Menu)
class MenuAdmin(TreeAdmin):
    ...
    change_form_template = 'adminlte/menu_change_form.html'
    formfield_overrides = {
        models.ForeignKey: {'widget': AdminlteSelect}
    }

# adminlte/menu_change_form.html
# active the target select
{% extends 'admin/change_form.html' %}

{% block extrajs %}
{{ block.super }}
<script>
    django.jQuery('#id_content_type').select2();
</script>
{% endblock %}

effect:

adminlte_select

AdminlteSelectMultiple

example:

# adminlte/admin.py
@admin.register(Menu)
class MenuAdmin(TreeAdmin):
    ...
    change_form_template = 'adminlte/menu_change_form.html'
    formfield_overrides = {
        # multiple for ManayToManyField
        models.ManayToManyField: {'widget': AdminlteSelectMultiple(
            attr={'style': 'width: 100%'}
        )}
    }

# adminlte/menu_change_form.html
# active the target select
{% extends 'admin/change_form.html' %}

{% block extrajs %}
{{ block.super }}
<script>
    django.jQuery('#id_content_type').select2();
</script>
{% endblock %}

effect:

adminlte_select

Menu

developing ...

Комментарий ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://gitlife.ru/oschina-mirror/wuyue92tree-django-adminlte-ui.git
git@gitlife.ru:oschina-mirror/wuyue92tree-django-adminlte-ui.git
oschina-mirror
wuyue92tree-django-adminlte-ui
wuyue92tree-django-adminlte-ui
1.3.0b1