You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We wanted django-activity-stream to handle some models from third-party apps, but since it's third-party, we can't modify its apps.py/__init__.py to register them. Older version of the docs said "You normally call register right after your model is defined (models.py) but you can call it anytime before you need to generate actions or activity streams", but that was removed in the current version, so I wonder if it still applies.
(We could create a wrapper over that third-party model and register this wrapper, but working with the model itself would be more convenient.)
The text was updated successfully, but these errors were encountered:
We tried registering third-party model from another app's AppConfig, and it appears to be working.
Still, would be nice to get a confirmation that this is the right way of doing things.
Our current code:
from django.apps import AppConfig
class MyAppConfig(AppConfig):
name = "myapp"
def ready(self):
from actstream import registry
from django_comments.models import Comment
registry.register(self.get_model("MyModel"))
registry.register(Comment)
It might or might not matter that myapp is below django_comments in the INSTALLED_APPS list.
Hello!
We wanted django-activity-stream to handle some models from third-party apps, but since it's third-party, we can't modify its
apps.py/__init__.py
to register them.Older version of the docs said "You normally call register right after your model is defined (models.py) but you can call it anytime before you need to generate actions or activity streams", but that was removed in the current version, so I wonder if it still applies.
(We could create a wrapper over that third-party model and register this wrapper, but working with the model itself would be more convenient.)
The text was updated successfully, but these errors were encountered: