Search code examples
djangodjango-middleware

Query easyaudit middleware model in Django


I'm using easyaudit to audit my Django CRUD and login operations. I would like to be able to access the easyaudit models with graphene queries so I can hook up to my frontend properly.

I'm not even sure how to import the models from middleware? How do I do that?


Solution

  • According to the GitHub page and code, django-easy-audit uses regular database models to store its info. The models can be found in the file https://github.com/soynatan/django-easy-audit/blob/master/easyaudit/models.py

    To access the data directly, you could query these models directly like this:

    from easyaudit.models import CRUDEvent, LoginEvent, RequestEvent
    CRUDEvent.objects.filter()
    

    I am not sure how you plan to integrate this with Graphene; I would need more info to guide you there.