Open Source CRM developed on Django framework with REST API for contact, lead, account, and opportunity management
File upload, storage, and sharing system with document organization, team-based sharing permissions, and attachment capabilities across all CRM entities.
List and search documents with filtering options.
def list_documents(title: str = None, status: str = None, shared_with: str = None,
limit: int = 10, offset: int = 0) -> dict:
"""
List documents with filtering and search.
Args:
title (str, optional): Filter by document title (partial match)
status (str, optional): Filter by status ('active', 'inactive')
shared_with (str, optional): Filter by shared team UUID
limit (int): Number of results per page (default: 10)
offset (int): Number of results to skip (default: 0)
Returns:
dict: Paginated documents with metadata
Headers Required:
Authorization: Bearer <access_token>
organization-id: <org_uuid>
Example:
GET /api/documents/?status=active&limit=5
Response:
{
"count": 18,
"next": "/api/documents/?limit=5&offset=5",
"previous": null,
"results": [
{
"id": "document-uuid",
"title": "Product Specification v2.1",
"document_file": "/media/documents/product_spec_v21.pdf",
"status": "active",
"shared_with": ["team1-uuid", "team2-uuid"],
"created_on": "2023-01-15T10:30:00Z",
"created_by": {
"id": "user-uuid",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@company.com"
}
}
]
}
"""Upload and create new documents with sharing permissions.
def create_document(document_data: dict, document_file: file) -> dict:
"""
Upload and create a new document.
Args:
document_data (dict): Document metadata and sharing information
document_file (file): File to upload
Returns:
dict: Created document details
Headers Required:
Authorization: Bearer <access_token>
organization-id: <org_uuid>
Content-Type: multipart/form-data
Example:
POST /api/documents/
Content-Type: multipart/form-data
Form data:
{
"title": "Contract Template 2023",
"status": "active",
"shared_with": ["sales-team-uuid", "legal-team-uuid"],
"document_file": <file upload>
}
Response:
{
"id": "new-document-uuid",
"title": "Contract Template 2023",
"document_file": "/media/documents/contract_template_2023.docx",
"status": "active",
"shared_with": ["sales-team-uuid", "legal-team-uuid"],
"created_on": "2023-02-01T09:00:00Z",
"created_by": {
"id": "user-uuid",
"first_name": "Alice",
"last_name": "Johnson",
"email": "alice.johnson@company.com"
}
}
"""Get comprehensive document information and perform updates.
def get_document(pk: str) -> dict:
"""
Get detailed document information.
Args:
pk (str): Document UUID
Returns:
dict: Complete document details with sharing information
Headers Required:
Authorization: Bearer <access_token>
organization-id: <org_uuid>
Example:
GET /api/documents/document-uuid/
Response:
{
"document_obj": {
"id": "document-uuid",
"title": "Product Specification v2.1",
"document_file": "/media/documents/product_spec_v21.pdf",
"status": "active",
"created_on": "2023-01-15T10:30:00Z",
"created_by": "user-uuid"
},
"shared_with": [
{
"id": "team1-uuid",
"name": "Product Team",
"users": [...team members...]
},
{
"id": "team2-uuid",
"name": "Sales Team",
"users": [...team members...]
}
],
"created_by": {
"id": "user-uuid",
"first_name": "John",
"last_name": "Smith",
"email": "john.smith@company.com"
}
}
"""
def update_document(pk: str, document_data: dict) -> dict:
"""
Update document information and sharing permissions.
Args:
pk (str): Document UUID
document_data (dict): Updated document information
Returns:
dict: Updated document details
Headers Required:
Authorization: Bearer <access_token>
organization-id: <org_uuid>
Example:
PUT /api/documents/document-uuid/
{
"title": "Product Specification v2.2 - FINAL",
"status": "active",
"shared_with": ["product-team-uuid", "sales-team-uuid", "support-team-uuid"]
}
"""
def delete_document(pk: str) -> None:
"""
Delete a document.
Args:
pk (str): Document UUID
Returns:
None: 204 No Content on success
Headers Required:
Authorization: Bearer <access_token>
organization-id: <org_uuid>
Example:
DELETE /api/documents/document-uuid/
"""class Document:
"""Document model for file storage and sharing"""
id: str # UUID
title: str # Required document title
document_file: str # File path/URL to uploaded document
status: str # 'active' or 'inactive'
# Sharing and permissions
shared_with: list[str] # Team UUIDs that have access
# Metadata
created_on: datetime
created_by: str # User UUID
org: str # Organization UUID
class DocumentSharing:
"""Document sharing information with teams"""
team_id: str # Team UUID
team_name: str # Team name
users: list[User] # Team members with access
class DocumentCreator:
"""Document creator information"""
id: str # User UUID
first_name: str
last_name: str
email: strDocuments support various file types including:
Documents can be in different states:
Documents use team-based permissions:
While not explicitly versioned, documents support:
Documents support multiple search and filter options:
title parameter for partial text matchingshared_with filter for team-based accessAll text-based filters support partial matching and are case-insensitive.
Documents can be used across CRM entities as attachments:
Install with Tessl CLI
npx tessl i tessl/pypi-django-crm