viewflow / django-material

Material Design for Django
http://viewflow.io/
BSD 3-Clause "New" or "Revised" License
2.48k stars 425 forks source link

Frontend modules are not listed #100

Closed Brandl closed 8 years ago

Brandl commented 8 years ago

Hello,

I just upgraded from a month old version to the newest version 0.7. Unfortunately some things broke on the way, and some are still not working.

I followed the new instructions closely, here is some code:

settings.py

INSTALLED_APPS = [
    'material',
    'material.frontend',
    'material.admin', 
[...]

TEMPLATES = [
{
    'BACKEND': 'django.template.backends.django.DjangoTemplates',
    'DIRS': [os.path.join(BASE_DIR, 'templates')]
    ,
    'APP_DIRS': True,
    'OPTIONS': {
        'context_processors': [
            'django.template.context_processors.debug',
            'django.template.context_processors.request',
            'django.contrib.auth.context_processors.auth',
            'django.contrib.messages.context_processors.messages',
            'material.frontend.context_processors.modules',
        ],
    },
},
]

main urls.py

from material.frontend import urls as frontend_urls

urlpatterns = [
url(r'', include(frontend_urls)),
url(r'^django-rq/', include('django_rq.urls')),
url(r'^$', RedirectView.as_view(url='app1/', permanent=False)),
]

app1/init.py

default_app_config = 'app1.apps.App1Config'

app1/apps.py

from django.apps import AppConfig
from material.frontend.apps import ModuleMixin

class App1Config(ModuleMixin, AppConfig):
    name = 'app1'
    icon = '<i class="mdi-communication-quick-contacts-dialer"></i>'

app1/urls.py

[...]
urlpatterns = [
    url(r'^$', App1List.as_view(), name='index'),
    url(r'^past/(?P<hours>[0-9]+)/$', App1PastList.as_view(), name='past'),

templates/app1/menu.html

<ul>
  <li><a class="no-pjax" href="/content/past/24">24 Stunden</a></li>
  <li><a class="no-pjax" href="/content/past/170">7 Tage</a></li>
</ul>

I guess I forgot something, because:

kmmbvnr commented 8 years ago

Sorry, I can't reproduce - https://bitbucket.org/snippets/kmmbvnr/9KGgB

Did you include app1 and app2 in the INSTALLED_APPS settings?

Did you run ./manage.py migrate after that?

kmmbvnr commented 8 years ago

Closed. No activity

Brandl commented 8 years ago

Sorry, yes migrate did fix it, I don't really understand why though.

kmmbvnr commented 8 years ago

Modules could be installed or uninstalled at runtime. The state managed by frontend.models.Module and at the last migrate step, the frontend creates a new module record.