Skip to content
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

Closed
wants to merge 4 commits into from

Conversation

anshuldutt21
Copy link

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.

Copy link
Member

@nemesifier nemesifier left a 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):
Copy link
Member

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

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)
Copy link
Member

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

#Models registered for test_project
admin_site.register(Operator, OperatorAdmin)
admin_site.register(RadiusAccounting, RadiusAccountingAdmin)
admin_site.register(Project, ProjectAdmin)
Copy link
Member

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),
]
Copy link
Member

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

@anshuldutt21
Copy link
Author

Hi @nemesisdesign can you review the changes. I have added the admin decorator.

Copy link
Member

@atb00ker atb00ker left a 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.

  1. 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

  1. Travis is failing please check that.

  2. [enhancement] Overrided django.contrib.admin.AdminSite #42 #48 might help it's solving this issue.

@nemesifier
Copy link
Member

Closed because duplicate of #48

@nemesifier nemesifier closed this Dec 20, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants