DIT Activity Stream
Project description
DIT Activity Stream
Installation
Read the Django Hawk installation documentation.
Add the package to your urls.py
file.
from django.urls import include, path
urlpatterns = [
...
path("dit-activity-stream/", include("dit_activity_stream.urls")),
...
]
How to implement?
Write your custom client, here is an example client for returning all users:
from typing import Any, Dict
from django.contrib.auth import get_user_model
from django.db.models import QuerySet
from django.http import HttpRequest
from dit_activity_stream.client import ActivityStreamClient
User = get_user_model()
class ActivityStreamUserClient(ActivityStreamClient):
object_uuid_field: str = "user_id"
object_last_modified_field: str = "last_modified"
def get_queryset(self, request: HttpRequest) -> QuerySet:
return User.objects.all()
def render_object(self, object: User) -> Dict:
return {
"id": object.id,
"username": object.username,
"first_name": object.first_name,
"last_name": object.last_name,
}
Where the following attributes:
object_uuid_field
is a field on the Object that is a Unique Identifier for the object.- This will be output in the URL GET parameter so it should be a UUID.
object_last_modified_field
us a field on the Object that holds a datetime value of when the object was last modified.- This will be output in the URL GET parameter.
Set DIT_ACTIVITY_STREAM_CLIENT_CLASS
in your django settings file:
DIT_ACTIVITY_STREAM_CLIENT_CLASS = "package.client.ActivityStreamUserClient"
Pushing to PyPI
Running make build
will build the package into the dist/
directory.
Running make push-pypi-test
will push the built package to Test PyPI.
Running make push-pypi
will push the built package to PyPI.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for dit-activity-stream-0.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 709a7d6465b3803246fc93ee3124ec73eec7b602f90874b08ec193c69fa8301a |
|
MD5 | 3ff283c712872667a9549c2112b7cfc0 |
|
BLAKE2b-256 | 9ff73b07f58713ad33944177044625f45b350c5ba8697e40320914b8ad44827e |
Close
Hashes for dit_activity_stream-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a475b8f7a44afd63a0f275c1ea19041868c9e3585d46833d63a13ed1ff0c82b |
|
MD5 | 7e782049bc2304768d792631f575be23 |
|
BLAKE2b-256 | 02b21fdb078f292018eeea41ead9da8ed05e2c92457e6add6fb21d046df48f1a |