Skip to content

Conversation

@mdkaifansari04
Copy link

Django Time Logging

A Django plugin for tracking time spent on GitHub issues with real-time timer functionality.
Fixes: #2

Features

  • Track time spent on specific GitHub issues
  • Real-time timer with live updates
  • Simple AJAX-based interface with no page reloads
  • Automatic duration calculation
  • View time log history
  • Direct integration with GitHub issues

Requirements

  • Python 3.11 or higher
  • Django 4.0 or higher

Installation

Install the plugin using pip:

pip install django-time-logging

Or install from source for development:

git clone https://github.com/OWASP-BLT/Fresh.git
cd Fresh/plugin/django-time-logging
pip install -e .

Configuration

Step 1: Add to Installed Apps

Add time_logging to your Django project's INSTALLED_APPS in settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    
    # Add time_logging
    'time_logging',
    
    # Your other apps
]

Step 2: Configure URL Routes

Include the time logging URLs in your project's urls.py:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path('admin/', admin.site.urls),
    path('time-logging/', include('time_logging.urls')),
    # Your other URL patterns
]

Step 3: Run Migrations

Apply the database migrations:

python manage.py migrate time_logging

Step 4: Create Base Template

The plugin requires a base template at templates/base.html with the following blocks:

<!DOCTYPE html>
<html>
<head>
    <title>{% block title %}{% endblock %}</title>
    <meta name="description" content="{% block description %}{% endblock %}">
    <meta name="keywords" content="{% block keywords %}{% endblock %}">
</head>
<body>
    {% block content %}{% endblock %}
</body>
</html>

Usage

Accessing the Time Logger

Navigate to http://your-domain.com/time-logging/ in your browser.

Starting a Time Log

  1. Enter a valid GitHub issue URL (example: https://github.com/owner/repo/issues/123)
  2. Click the "Start Time Log" button
  3. The timer will begin tracking automatically

Stopping a Time Log

  1. Click the "Stop Time Log" button on the active timer
  2. The duration will be calculated and saved automatically

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Time Logging: Modularize as a Django pluggable app.

1 participant