Coder Social home page Coder Social logo

Comments (7)

ScottHull avatar ScottHull commented on September 2, 2024 1

Sure thing. Worth noting that I verified that this package was installed correctly (i.e. in INSTALLED_APPS) and that I had run the migrations.

Python==3.5.6
Django==2.1.5
djangorestframework==3.7.7

Edit: typo

from djangorestframework-api-key.

ScottHull avatar ScottHull commented on September 2, 2024 1

Excellent, thank you for following up with this in such a timely manner! Unfortunately I'm a bit busy to attempt a PR at the moment, but I'll keep it in mind if I get a moment.

My temporary fix that I listed in the first comment is working well for my project, especially since I made many custom modifications in the form of subclassing your models.

from djangorestframework-api-key.

florimondmanca avatar florimondmanca commented on September 2, 2024

Hi Scott, thanks for reporting this. I did not get this error on my side. Also this is the first time someone has issues with the admin panel not showing up in the admin site. Can you share the Python, Django and DRF versions you are using?

from djangorestframework-api-key.

florimondmanca avatar florimondmanca commented on September 2, 2024

So, I was able to reproduce the issue with the versions you listed. I just had to run system checks after creating a new project and adding the DRF and DRF-api-key apps:

$ ./manage.py check
SystemCheckError: System check identified some issues:

ERRORS:
<class 'rest_framework_api_key.admin.APIKeyAdmin'>: (admin.E108) The value of 'list_display[4]' refers to 'has_expired_func', which is not a callable, an attribute of 'APIKeyAdmin', or an attribute or method on 'rest_framework_api_key.APIKey'.

System check identified 1 issue (0 silenced).

Upgrading the Django and DRF versions to the latest available did not fix this either, so this is definitely a serious bug!

The following fixed the system checks:

  • Edit models.py, basically unwrapping the custom @djangoproperty:
    def _has_expired(self) -> bool:
        ...
    
    _has_expired.short_description = "Has expired"
    _has_expired.boolean = True
    has_expired = property(_has_expired)
  • Edit admin.py to use _has_expired.

If you're up for it, feel free to open a PR with these. :-)

from djangorestframework-api-key.

florimondmanca avatar florimondmanca commented on September 2, 2024

Gotcha, I'll try and find some time to publish the fix later today then. :-) I suppose this is affecting all users of 1.2, so it's best if we get this out asap.

especially since I made many custom modifications in the form of subclassing your models.

We have an open issue to provide an abstract API key model to make it easier to customize API keys: #34. If that's something you'd be interested in, feel free to check it out and share your thoughts!

from djangorestframework-api-key.

Madril avatar Madril commented on September 2, 2024

Same is happening with Django 2.1.*, Python 3.7.3 and DRF 3.9

from djangorestframework-api-key.

florimondmanca avatar florimondmanca commented on September 2, 2024

Released in v1.2.1. 👍

from djangorestframework-api-key.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.