Comments (3)
- path('ui/', include('ui.urls')),
path('ui/', include(frontend_urls)),
the first line seems redundant. Frontend perform modules app configs auto-discovery
from django-material.
Thanks for your response. I'm still stuck on this issue. I've tried various combinations of configs but at the moment my global urls.py
is
urlpatterns = [
path('', include('ui.urls')),
# path('', include('schema.urls')),
path('', include(frontend_urls)),
]
and the UI module urls.py
is
urlpatterns = [
path('', generic.RedirectView.as_view(url='./cameramodel/', permanent=False), name="index"),
path('cameramodel/', include(views.CameraModelViewSet().urls)),
]
If I hit /ui/cameramodel/
I get
NoReverseMatch at /ui/cameramodel/
Reverse for 'cameramodel_add' not found. 'cameramodel_add' is not a valid view function or pattern name.
I still don't understand why cameramodel_add
can't be found. My views.py
is
from material.frontend.views import ModelViewSet
from schema import models
class CameraModelViewSet(ModelViewSet):
model = models.CameraModel
Thanks
from django-material.
I abandoned work on my project because of this blocker, but I've returned to it and I've started trying to reimplement a UI with django-material again from scratch. I'm running into the same error again 😞
- the parent app is
camerahub
- the app which contains an existing
models.py
isschema
- the app which contains a skeleton Material project is
ui
The schema
app used to contain a bunch of views I wrote myself, but I have now deleted everything apart from models.py
.
# camerahub/urls.py
from django.contrib import admin
from django.urls import include, path
from material.frontend import urls as frontend_urls
urlpatterns = [
path('', include(frontend_urls)),
path('', include('schema.urls')),
path('api/', include('api.urls')),
path('admin/', admin.site.urls),
path('accounts/', include('django_registration.backends.activation.urls')),
path('accounts/', include('django.contrib.auth.urls')),
path('', include('django_prometheus.urls')),
path('ratings/', include('star_ratings.urls', namespace='ratings')),
path('health/', include('health_check.urls')),
]
# ui/urls.py
from unicodedata import name
from django.urls import path, include
from django.views import generic
from . import views
urlpatterns = [
path('', generic.RedirectView.as_view(url='./cameramodel/'), name="index"),
path('cameramodel/', include(views.CameraModelViewSet().urls)),
]
# ui/views.py
from material.frontend.views import ModelViewSet
from schema import models
# class MyModelViewSet(ModelViewSet):
# model = models.MyModel
class CameraModelViewSet(ModelViewSet):
model = models.CameraModel
Trying to browse to http://127.0.0.1:8000/ui/cameramodel/
I get
Internal Server Error: /ui/cameramodel/
Traceback (most recent call last):
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/core/handlers/exception.py", line 47, in inner
response = get_response(request)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/core/handlers/base.py", line 181, in _get_response
response = wrapped_callback(request, *callback_args, **callback_kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/views/generic/base.py", line 70, in view
return self.dispatch(request, *args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/utils/decorators.py", line 43, in _wrapper
return bound_method(*args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/contrib/auth/decorators.py", line 21, in _wrapped_view
return view_func(request, *args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/material/frontend/views/list.py", line 531, in dispatch
return super(ListModelView, self).dispatch(request, *args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/material/frontend/views/list.py", line 357, in dispatch
return handler(request, *args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/material/frontend/views/list.py", line 315, in get
context = self.get_context_data()
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/material/frontend/views/list.py", line 521, in get_context_data
kwargs['add_url'] = reverse('{}:{}_add'.format(opts.app_label, opts.model_name))
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/urls/base.py", line 86, in reverse
return resolver._reverse_with_prefix(view, prefix, *args, **kwargs)
File "/home/jonathan/.cache/pypoetry/virtualenvs/camerahub-FNy4MBnC-py3.10/lib/python3.10/site-packages/django/urls/resolvers.py", line 698, in _reverse_with_prefix
raise NoReverseMatch(msg)
django.urls.exceptions.NoReverseMatch: Reverse for 'cameramodel_add' not found. 'cameramodel_add' is not a valid view function or pattern name.
"GET /ui/cameramodel/ HTTP/1.1" 500 117163
from django-material.
Related Issues (20)
- Material ModelViewSet DetailModelView: Limit the model fields shown in the details page HOT 1
- Double InputHidden rendering HOT 2
- suggestion for quickstart tutorial page HOT 1
- List view slow since 1.9.0 HOT 1
- Theme - Difference Between Colors
- AjaxMultipleModelSelect rendering is unpolished HOT 2
- Filters defined in ModelViewSet's get_queryset method are not applied to Detail and Delete views HOT 1
- Editable fields on list view
- Duplicated query in update view HOT 2
- Warning when recompile material.components.js with closure compiler HOT 3
- Receiving SynchronousOnlyOperation at /admin/ HOT 2
- There's no error rendered for hidden fields.
- if statement fetch all rows, slowdown HOT 1
- Tooltip not initialized HOT 1
- django.urls.exceptions.NoReverseMatch: Reverse for 'cameramodel_add' not found.
- Context processor makes invalid assumptions about request.user
- Django (v4.1) ManifestStaticFilesStorage throws error in combinaton with material (v1.11.2)
- Security issues (XSS) in materialize-css, Can you upgrade to newer version please? HOT 1
- Reverse for 'index' not found. 'index' is not a valid view function or pattern name. HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from django-material.