justquick / django-activity-stream

Generate generic activity streams from the actions on your site. Users can follow any actors' activities for personalized streams.
http://django-activity-stream.rtfd.io/en/latest/
BSD 3-Clause "New" or "Revised" License
2.38k stars 482 forks source link

Not working with Django 4.1 #515

Closed marcusaram closed 2 years ago

marcusaram commented 2 years ago

Django has removed de installed property from the Model Options object (_meta). And will produce the following error when using Django Activity Stream

AttributeError: 'Options' object has no attribute 'installed' this comes from actstream/registry.py line 60 (version 1.4.1).

See this commit from Django https://github.com/django/django/commit/8e3b1cf098018b4632de63c359ef6d761e92ec04

auvipy commented 2 years ago

can you work to fix this?

marcusaram commented 2 years ago

I will create a PR

marcusaram commented 2 years ago

@auvipy See PR #516

justquick commented 2 years ago

ive backed out the PR after getting some errors in the feed tests actstream/tests/test_drf.py:107 [ErrorDetail(string='Invalid model - model not available.', code='invalid')] needs some more testing but django4.1 seems to b working in the test suite but gotta make sure its testing that method

marcusaram commented 2 years ago

Is this still an issue? I really don't understand why this change will cause issues since Django's code on the property installed was just checking if app_config is not None. But on what env is that test failing?

ThomasTheHuman commented 2 years ago

Any update on this?

umagloire99 commented 2 years ago

Please any update on this issue? am facing the same error

justquick commented 2 years ago

i just pushed the change to main branch. going to make a django 4.1 release

wilson1999112 commented 1 year ago

For those who also face this before they make django 4.1 release and still want to use django 4.1, maybe this could help:

from django.apps import AppConfig

def is_installed(model_class):
    return model_class._meta.app_config is not None

class MyAppConfig(AppConfig):
    default_auto_field = 'django.db.models.BigAutoField'
    name = 'myapp'
    def ready(self):
        from actstream import registry
        registry.is_installed = is_installed
        registry.register(self.get_model('mymodel'))