django-daiquiri / daiquiri

A framework for the publication of scientific databases
https://escience.aip.de/daiquiri
Apache License 2.0
26 stars 8 forks source link

Remove hard coded dependency on stats from the files app #249

Closed kimakan closed 1 month ago

kimakan commented 1 month ago

Closes #248

coveralls commented 1 month ago

Pull Request Test Coverage Report for Build 11233210493

Details


Changes Missing Coverage Covered Lines Changed/Added Lines %
daiquiri/files/utils.py 1 4 25.0%
<!-- Total: 1 4 25.0% -->
Totals Coverage Status
Change from base Build 10420115417: -0.02%
Covered Lines: 4820
Relevant Lines: 7535

💛 - Coveralls
jochenklar commented 1 month ago

Hi @kimakan , while this should work, the django way to do this would be:

from django.apps import apps

if apps.is_installed('daiquiri.stats'):
    from daiquiri.stats.models import Record
    ...

we had a similar problem here: https://github.com/django-daiquiri/daiquiri/blob/master/daiquiri/oai/adapter.py#L365

Also, I would add that to all Record.objects.create().

kimakan commented 1 month ago

Hi @jochenklar , thanks for the suggestion! I thought about adding this to every Record.objects.create() but in the end, it would not solve the dependency in the migrations, so I didn't do it.