django-activity-stream: Missing target while using actor_stream
hi.
I’m expecting troubles with actor_stream(request.user).
for example:
from actstream.models import actor_stream, Action
print actor_stream(request.user)[0].target # returns None
print Action.objects.all()[0].target # returns Target object
BUT:
from actstream.models import actor_stream, Action
print request.user.actor_actions.all()[0].target # returns Target object
User model - this is a custom user model, configured as described in djangoproject tutorial. Target model looks like this:
class Task(models.Model):
id = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
user = models.ForeignKey('core_auth.User', blank=True, null=True)
... < more fields >
Let me show you:
>>> from actstream.models import actor_stream, Action
>>> from core_auth.models import User
>>> u = User.objects.get(username='fynjah')
>>> actor_stream(u)[0].target # None
>>> x = actor_stream(u)[0]
>>> x
<Action: fynjah changed status DONE 58 minutes ago>
# BUT:
>>> x.target_content_type
<ContentType: Task>
>>> x.target
>>> x.target_object_id
u'f08ae5ab-8c07-4929-9021-62c867f0d081'
# AND:
>>> u.actor_actions.all()[0].target
<Task: wdstrm compositing>
What am i doing wrong :\
About this issue
- Original URL
- State: closed
- Created 9 years ago
- Comments: 18 (3 by maintainers)
Same issue here, in the same context (using uuids as primary keys). This kind of issue is frequent in django extensions, uuids are not a smooth ride.
@auvipy Even though the change is made in Django, based on a brief look at the code, it appears as though the Action model would need to be changed to accomodate UUIDs. I ended up using UUID’s as secondary keys for my models, and having actstream hook up with my standard autoincrement pks. If you want to use UUID’s and actstream, this is probably the best you can do until the code fixes are in place. Unfortunately I am not competent enough to make said code changes.