-
Notifications
You must be signed in to change notification settings - Fork 116
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
getting error in admin url #49
Comments
@shivshankarkeshari can you provide additional information on how to reproduce the issue? What Django version you are using etc? |
I'm running into the same issue, working with Django 3.1. In my case the issue could be reproduced by adding the import django_filters as filters I was using this way of import in two separate XyzFilter classes, which provided some filtering functionality to my tables. As long as I only had the first XyzFilter imported in some other file, like the views.py, everything was fine. But as soon as I imported the second XyzFilter in another file, the error showed up. I'm a little confused, since if the way of importing would cause the error, it should not show your consumerAdmin as reason for this. For me, I fixed it by changing the imports back to import django_filters and using them as they are. |
I found a way to reproduce this: However on a re-run of the django runserver command, the initialization of the sso server object inside the main urls.py, -however- triggers this error, which is highly confusing for me as well. I suggest the following change inside of class Server(object):
...
def register_admin(self):
try:
admin.site.register(Consumer, self.client_admin)
except AlreadyRegistered:
# Since this error only occurs if the admin is -idk why- already registered, you might catch this one and continue
pass |
thanks for the additional info @Rastopapola, would be awesome to have a PR addressing the issue :) |
@FinalAngel Since I stumbled on this one again, I'm pretty sure now this is a result of a general missing import statement. class A(baseA):
_a_member = package.Object() where import package
class A(baseA):
_a_member = package.Object() To be honest: I'm absolutely not sure why this error is even thrown at this point... One would expect an ImportError or some kind of this due to the 'unknown' `package declaration. It's just an idea but maybe the Please let me know if I'm sounding strangely confused or this does make sense. If so, simply try-catching would maybe not the best way in here. Maybe you could refactor the |
@FinalAngel I just forked your project and implemented the Singleton pattern. Tests are running fine and when I include my local version of simple-sso, I'm now seeing the correct I will create a PullRequest tomorrow. You may take a look on my changes and by this, I would be very happy to contribute to your project. |
Pull Request #52 has been created |
django.contrib.admin.sites.AlreadyRegistered: The model Consumer is already registered with 'sso_server.ConsumerAdmin'.
The text was updated successfully, but these errors were encountered: