django-suit icon indicating copy to clipboard operation
django-suit copied to clipboard

where is the SUIT_CONFIG in v2?

Open Ru7z opened this issue 7 years ago • 7 comments

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?

Ru7z avatar Apr 17 '18 11:04 Ru7z

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'),
        ...

gamesbook avatar Apr 18 '18 08:04 gamesbook

@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

tyctor avatar Dec 08 '19 14:12 tyctor

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

gamesbook avatar Dec 08 '19 15:12 gamesbook

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

tyctor avatar Dec 08 '19 16:12 tyctor

My example is shown above.

gamesbook avatar Dec 09 '19 06:12 gamesbook

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 avatar Dec 09 '19 08:12 tyctor

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

tyctor avatar Dec 09 '19 17:12 tyctor