-
Notifications
You must be signed in to change notification settings - Fork 73
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Override the django Admin Site issues/#42 #50
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Needs work, see my inline comments.
|
||
def openwisp_admin(site_url=None): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this must not be removed in order to retain backward compatibility
openwisp_utils/admin_theme/admin.py
Outdated
from django.conf import settings | ||
from django.contrib import admin | ||
from django.utils.translation import ugettext_lazy | ||
from django.contrib.admin import AdminSite | ||
from django.contrib.auth import get_user_model | ||
from openwisp_users.models import (Group, Organization, OrganizationOwner, OrganizationUser,User) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you must not import test models in the actual library code
openwisp_utils/admin_theme/admin.py
Outdated
#Models registered for test_project | ||
admin_site.register(Operator, OperatorAdmin) | ||
admin_site.register(RadiusAccounting, RadiusAccountingAdmin) | ||
admin_site.register(Project, ProjectAdmin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you should not do this
tests/urls.py
Outdated
url(r'^admin/', admin.site.urls), | ||
] | ||
url(r'^admin/', admin_site.urls), | ||
] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
configure your edito to automatically add new lines at the end of the file
Hi @nemesisdesign can you review the changes. I have added the admin decorator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the issue is taken care of at #48 but since you are here to learn to contribute, I see many things need attention here.
- We need to ensure clean commit history so that we understand our changes while releasing and / or tracking a bug in the future, so please help us keeping the commit history clean and submit only one commit that follows the guidelines.
Commit guidelines here: http://openwisp.io/docs/developer/contributing.html#how-to-commit-your-changes-properly
-
Travis is failing please check that.
-
[enhancement] Overrided django.contrib.admin.AdminSite #42 #48 might help it's solving this issue.
Closed because duplicate of #48 |
We needed to override the vanilla admin class. So I did the following tasks-
-Customized the Admin Site class by creating a class subclassing the Admin Site class and instancing it as shown in the link provided.
-Registered the Site, users and organizations and test_project models.
-Changed the url links accordingly.