darklow / django-suit

Modern theme for Django admin interface
http://djangosuit.com/
Other
2.31k stars 701 forks source link

where is the SUIT_CONFIG in v2? #677

Open Ru7z opened 6 years ago

Ru7z commented 6 years ago

How can i config SUIT_CONFIG (settings.py in v1) in v2?

BTW, can i remove my actions and Authentication and Authorization in admin page?

gamesbook commented 6 years ago

Look in settings\apps.py.

My file looks something like:

# -*- coding: utf-8 -*-
"""
Django Suit Configuration Module
"""
from django.apps import AppConfig
from django import get_version
from suit.apps import DjangoSuitConfig
from suit.menu import ParentItem, ChildItem

class SuitConfig(DjangoSuitConfig):
    layout = 'horizontal'  # or 'vertical'
    name = 'suit'
    django_version = get_version()

    menu = (
        ParentItem('Client', children=[
            ChildItem(model='myapp.model1'),
            ChildItem(model='myapp.model2),
        ], icon='fa fa-example-o'),
        ...
tyctor commented 4 years ago

@gamesbook i cant get custom menu in admin, instead i am still getting all available apps models. i have two django apps, i have code that you adviced in one of them, and i want to use it as default menu in admin site. i think that menu is generated in templatetags/suit_menu.py get_menu function, which takes context.available_apps and passes it into MenuManager(available_apps, context, request). in MenuManager.__init__ is call self.current_app = get_current_app(request) which always return admin so i cant see how to use menu definition from my own app. can you please advice me what i am doing wrong? using django 2.2

gamesbook commented 4 years ago

@tyctor I am not using the method you describe so I am not sure how to help.

tyctor commented 4 years ago

ok, thanks for answer @gamesbook could you please describe your configuration how you using suit custom menu?

gamesbook commented 4 years ago

My example is shown above.

tyctor commented 4 years ago

ok, so this is only code what you need to get custom menu work in django admin? cant believe this, because that was first thing what i tryied: traverse through demo code, and try code from demo/apps.py i have suit v2 theme, but not custom menu, so i think something is missing, and cant figure out what it is

tyctor commented 4 years ago

ok, i figured out where was problem, i mixed configs for django app and django suit, now it is working