Skip to content
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

Not working with Django 4.1 #515

Closed
marcusaram opened this issue Aug 16, 2022 · 9 comments
Closed

Not working with Django 4.1 #515

marcusaram opened this issue Aug 16, 2022 · 9 comments

Comments

@marcusaram
Copy link
Contributor

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 django/django@8e3b1cf

@auvipy
Copy link
Collaborator

auvipy commented Aug 16, 2022

can you work to fix this?

@marcusaram
Copy link
Contributor Author

I will create a PR

@marcusaram
Copy link
Contributor Author

@auvipy See PR #516

justquick added a commit that referenced this issue Aug 18, 2022
Fixes #515 - Make it work with Django 4.1
@justquick
Copy link
Owner

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

@justquick justquick reopened this Aug 18, 2022
@marcusaram
Copy link
Contributor Author

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
Copy link

Any update on this?

@umagloire99
Copy link

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

@justquick
Copy link
Owner

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

@wilson1999112
Copy link

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'))

auvipy added a commit that referenced this issue Sep 5, 2024
* use python base image for simplicity

* updating dev env w/ helpers

* wip: actstream/registered models as factories for DRF

* DRF testing and updates

* drf extras for package

* default permissions, custom viewsets

* allow a 'my actions' view as viewset action

* settings refactor

* testing fix, user serializer to hide password

* dont require drf for testing app

* install drf for actions

* install drf generics for actions

* action posting and model/object drf feeds

* weird ordering issues in tests

* viewset ordering, test debugging for gh actions

* weird db auto id bug? hope this works

* drf following

* add drf urlconf to actstream.urls

* drf-spectacular in runtests

* weird recursion error on urls

* use expand fields as default behavior

* use pytest finally

* set sane ordering in qs, not on drf ordering fields

* runtest project changes, more granular custom permissions/viewsets

* dont load test data 2x

* fugly settings remvoed

* label model url names

* testing restricted permissions

* MODEL_FIELDS setting/testing

* test fix

* +pytest.ini

* renamed to streams

* renamed to streams

* old decorators for compat.

* readonly + public

* manager arg typing

* fixing test warnings

* adding more streams from managers to views

* views for following/follows/is_following

* testfix for missing field

* check post vs get for action sending

* spectacular in runtests

* dont require drf-spectacular for runtests

* only test on push to main

* test fix

* local db setting overrides

* move testapp tests to testapp and out of actstream

* wip: using drf-spectacular to autogen api docs

* use drf-spectacular

* Django>=3.2

* Remove mysql details from docstring (#511)

* Remove mysql details from docstring

The django-mysql JSONField option (introduced before Django had its own builtin JSONField) has been removed, so we should not mention it in the docstring anymore.

* Fix typos

* docs: Fix a few typos

There are small typos in:
- actstream/actions.py
- docs/concepts.rst

Fixes:
- Should read `untranslated` rather than `unstranslated`.
- Should read `terminology` rather than `terminiology`.

Signed-off-by: Tim Gates <tim.gates@iress.com>

* +drf module to setup

* new api docs

* s/master/main/g trying coverage

* v2 codeql, no coverage

* new github workflow badge query

* github actions + coveralls?

* coveralls?

* parallel coverage?

* no custom coverage file name

* coveralls

* Fixes #515 - Make it work with Django 4.1

* Fixes #515 - Change comment to the change

* django 4.1 in tox

* separate django from drf tests

* fix typo in installation docs.

* strip out drf spectacular for now

* remove json field compatibility, force django 3.2, refs #480

* start of drf docs

* 1.4.2 prep

* updating authors and changelog ln

* updating drf docs

* Create SECURITY.md

* fix for #524 datetime_safe removal

* feat(follows): delete object-orphaned Follows...

... based on Django pre_delete signal

* Update codeql-analysis.yml

* Create dependabot.yml

* Bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump actions/upload-artifact from 2 to 3

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 2 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](actions/upload-artifact@v2...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* Bump actions/checkout from 3 to 4

Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v3...v4)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>

* changelog entry for v2.0.0 release

* Bump version to v2.0.0

* remove unused imports

* add swappable models for drf part

* add swappable models for drf part

* release 2.0.1

---------

Signed-off-by: Tim Gates <tim.gates@iress.com>
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Justin Quick <jquick@stsci.edu>
Co-authored-by: Justin Quick <justquick@gmail.com>
Co-authored-by: Christoph Bülter <cb109@users.noreply.github.com>
Co-authored-by: Tim Gates <tim.gates@iress.com>
Co-authored-by: Marcus Aram <marcus@oxar.nl>
Co-authored-by: Justin Quick <justquick@users.noreply.github.com>
Co-authored-by: khial mustapha <khial.mustaphab32@gmail.com>
Co-authored-by: Jens Nistler <opensource@jensnistler.de>
Co-authored-by: David Guillot <dguillot@contexte.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Artush Ghazaryan <artush.ghazaryan@softconstruct.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants