Skip to content

iiasa/threads

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Comment threads and annotations for ACCMS and otherwise

The content management system of the Accelerator or otherwise can back multiple websites. To support comment threads or annotations on a web component such as a chart, there is need for a multi-tenant service. This repo defines that service.

Use

Making first public tenant

from tenants.models import Client, Domain

tenant = Client(name="Main", schema_name="public")
Domain.objects.create(
    domain="admin.localhost",
    tenant=tenant,
    is_primary=True
)

Make tenant superuser

from django_tenants.utils import schema_context
from django.contrib.auth import get_user_model

User = get_user_model()

with schema_context('tenant1'):
    User.objects.create_superuser(
        username='admin',
        email='admin@example.com',
        password='admin123'
    )

Codebase overview

Django-based multi-tenant RESTful API designed for managing nested comment threads and annotations, primarily for integration with the Accelerator Content Management System (ACCMS) or similar platforms. It supports multiple websites/tenants via django-tenants, allowing isolated schemas for different clients (e.g., public tenant and custom ones like 'tenant1').

Key components:

  • Multi-Tenancy: Uses tenants app with Client and Domain models. Shared apps include tenant management; tenant-specific apps handle comments and auth.
  • Comments App: Core functionality for threaded comments. Models include Comment with user, text, parent (for replies), thread_id, likes (ManyToMany), soft-delete flag. Supports nesting, likes/unlikes, email notifications to thread participants on new comments/likes.
  • Authentication: Token-based (DRF), dj-rest-auth, allauth for email verification (mandatory), Google OAuth, anonymous login (creates user with random password). Email auth preferred over username.
  • API Features: DRF ViewSet for CRUD on comments (list roots only by default, filter by thread prefix, search text). Custom actions: like/unlike, soft-delete. OpenAPI schema via drf-spectacular.
  • Other: PostgreSQL backend, production-ready (Whitenoise, Gunicorn, CORS), email via SMTP/console, static files handling. Docker support implied.

The API is exposed for frontend integration (e.g., charts/annotations), with endpoints for threads, replies, interactions. No frontend code; pure backend service.

About

multi tenant comments threads service

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors