burke-software / django-mass-edit

Make bulk changes in the Django admin interface
152 stars 67 forks source link

invalid syntax (urls.py, line 4) #40

Closed ghost closed 9 years ago

ghost commented 9 years ago

Default urls.py with a couple options only default admin setting and then massadmin, but getting an error message saying basically that can't reference .urls in massadmin. I have this setup in settings.py and i did end up having to import massadmin in urls.py to get the reference for massadmin to work. But not .urls

from django.conf.urls import patterns, include, url

from django.contrib import admin from import massadmin import *

admin.autodiscover()

admin.site.site_header = "FireByte Networks"

urlpatterns = patterns('',

Examples:

# url(r'^$', 'cms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(massadmin.urls)),
url(r'^admin/', include(admin.site.urls)),

)

bufke commented 9 years ago

I don't quite follow. I just accepted a documentation pull request and cleaned up some strange things in urls.py. Perhaps try again now? What is the error message you get?

ghost commented 9 years ago

Sorry some more color here..I just updated it to test this again. URLS.PY = from django.conf.urls import patterns, include, url

from django.contrib import admin import massadmin

admin.autodiscover()

admin.site.site_header = "FireByte Networks"

urlpatterns = patterns('',

Examples:

# url(r'^$', 'cms.views.home', name='home'),
# url(r'^blog/', include('blog.urls')),
url(r'^admin/', include(massadmin.urls)),
url(r'^admin/', include(admin.site.urls)),

)


ERROR:

AttributeError at /admin/main/asset/export/

'module' object has no attribute 'urls'

Request Method: GET Request URL: http://localhost:8000/admin/main/asset/export/ Django Version: 1.7.5 Exception Type: AttributeError Exception Value:

'module' object has no attribute 'urls'

Exception Location: /Users/acooley/Documents/Projects/ems/cms/urls.py in , line 14 Python Executable: /System/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python Python Version: 2.7.6 Python Path:

['/Users/acooley/Documents/Projects/ems', '/Library/Python/2.7/site-packages/virtualenv-12.0.5-py2.7.egg', '/Library/Python/2.7/site-packages/virtualenvwrapper-4.3.2-py2.7.egg', '/Library/Python/2.7/site-packages/stevedore-1.2.0-py2.7.egg', '/Library/Python/2.7/site-packages/virtualenv_clone-0.2.5-py2.7.egg', '/Library/Python/2.7/site-packages/six-1.9.0-py2.7.egg', '/Library/Python/2.7/site-packages/argparse-1.3.0-py2.7.egg', '/Library/Python/2.7/site-packages/pbr-0.10.7-py2.7.egg', '/Library/Python/2.7/site-packages', '/Users/acooley/Documents/Projects/ems', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python27.zip', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-darwin', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/plat-mac/lib-scriptpackages', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-tk', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-old', '/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload', '/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/PyObjC']

Server time: Sun, 8 Mar 2015 03:37:10 +0000

ghost commented 9 years ago

Actually just figured this out with pycharm, need to have the following imports on urls.py?

import massadmin import massadmin.urls

Is this just an issue with me or does the documentation need updated some more?

bufke commented 9 years ago

Adding Add (r'^admin/', include("massadmin.urls")), to urls.py as described in the README works fine for me. I'm not sure why you are importing massadmin.urls.

url(r'^admin/', include(massadmin.urls)), doesn't have the quotes. Is that your problem? I think this is a mistake on your end, but if not please reopen. I apologize I couldn't get back sooner, time is always limited.

catchmeifyoucaan commented 2 years ago

someone help me out thi has been killing me for days in django, i just started python and im trying to set up a application phase in django and im getting syntax error

from django.contrib import admin from django.urls import include, path the from on this line is showing pylint syntax error, please what to do

urlpatterns = [ path('admin/', admin.site.urls),

Use include() to add paths from the catalog application

from django.urls import include, path

urlpatterns = [ path('catalog/', include('catalog.urls')), path('admin/', admin.site.urls), ]