mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-20 16:31:08 -05:00
Add version control context processor and integrate map functionality with dedicated JavaScript
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
from typing import Optional, List, Dict, Any, Tuple
|
||||
from typing import Optional, List, Dict, Any, Tuple, Union
|
||||
from django.db import transaction
|
||||
from django.core.exceptions import ValidationError
|
||||
from django.utils import timezone
|
||||
from django.contrib.auth import get_user_model
|
||||
from django.contrib.auth.models import AbstractUser
|
||||
from django.contrib.contenttypes.models import ContentType
|
||||
from .models import VersionBranch, VersionTag, ChangeSet
|
||||
|
||||
@@ -11,10 +12,8 @@ User = get_user_model()
|
||||
class BranchManager:
|
||||
"""Manages version control branch operations"""
|
||||
|
||||
@transaction.atomic
|
||||
def create_branch(self, name: str, parent: Optional[VersionBranch] = None,
|
||||
user: Optional[User] = None) -> VersionBranch:
|
||||
"""Create a new version branch"""
|
||||
user: Optional['User'] = None) -> VersionBranch:
|
||||
branch = VersionBranch.objects.create(
|
||||
name=name,
|
||||
parent=parent,
|
||||
@@ -29,7 +28,7 @@ class BranchManager:
|
||||
|
||||
@transaction.atomic
|
||||
def merge_branches(self, source: VersionBranch, target: VersionBranch,
|
||||
user: Optional[User] = None) -> Tuple[bool, List[Dict[str, Any]]]:
|
||||
user: Optional['User'] = None) -> Tuple[bool, List[Dict[str, Any]]]:
|
||||
"""
|
||||
Merge source branch into target branch
|
||||
Returns: (success, conflicts)
|
||||
@@ -66,9 +65,8 @@ class BranchManager:
|
||||
class ChangeTracker:
|
||||
"""Tracks and manages changes across the system"""
|
||||
|
||||
@transaction.atomic
|
||||
def record_change(self, instance: Any, change_type: str,
|
||||
branch: VersionBranch, user: Optional[User] = None,
|
||||
branch: VersionBranch, user: Optional['User'] = None,
|
||||
metadata: Optional[Dict] = None) -> ChangeSet:
|
||||
"""Record a change in the system"""
|
||||
if not hasattr(instance, 'history'):
|
||||
|
||||
Reference in New Issue
Block a user