Skip to content

Conversation

@mdkaifansari04
Copy link

@mdkaifansari04 mdkaifansari04 commented Nov 26, 2025

Fixes: #4

Quick Testing Guide for BLT Hackathon Plugin

Test video

2025-11-27.00-00-16_compressed.mp4

This guide will help you quickly test the Django Hackathon plugin in under 5 minutes.

Prerequisites

  • Python 3.11+
  • Django knowledge (basic)

Step 1: Create a Test Django Project

# Create a new directory for testing
mkdir hackathon-test && cd hackathon-test

# Create virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install Django
pip install django

# Create Django project
django-admin startproject testproject
cd testproject

Step 2: Install the Hackathon Plugin

# Install from TestPyPI
pip install -i https://test.pypi.org/simple/ blt-hackathon==0.1.1

Latest Version: Check https://test.pypi.org/project/blt-hackathon for the newest version.

Step 3: Configure Django Settings

Edit testproject/settings.py:

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    
    # Add the hackathon plugin
    'blt_hackathon',
]

Step 4: Configure URLs

Edit testproject/urls.py:

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

urlpatterns = [
    path('admin/', admin.site.urls),
    path('hackathons/', include('blt_hackathon.urls')),
]

Step 5: Create Base Template (Required for Charts)

Create directory and file: testproject/templates/base.html

mkdir templates

Create templates/base.html:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{% block title %}Hackathon Test{% endblock %}</title>
    
    <!-- Required: Chart.js for charts -->
    <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
    
    <!-- Required: Font Awesome for icons -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css" 
          integrity="sha512-DTOQO9RWCH3ppGqcWaEA1BIZOC6xxalwEsw9c2QQeAIftl+Vegovlnee1c9QX4TctnWMn13TZye+giMm8e2LwA==" 
          crossorigin="anonymous" referrerpolicy="no-referrer" />
    
    <!-- Optional: Basic styling -->
    <script src="https://cdn.tailwindcss.com"></script>
    
    {% block extra_head %}{% endblock %}
</head>
<body class="bg-gray-100">
    <div class="container mx-auto py-8">
        {% block content %}{% endblock %}
    </div>
    
    <!-- Required: Scripts block for Chart.js initialization -->
    {% block scripts %}{% endblock %}
</body>
</html>

Update testproject/settings.py to include templates directory:

TEMPLATES = [
    {
        'BACKEND': 'django.template.backends.django.DjangoTemplates',
        'DIRS': [BASE_DIR / 'templates'],  # Add this line
        'APP_DIRS': True,
        'OPTIONS': {
            # ... rest of the config
        },
    },
]

Step 6: Run Migrations and Create Superuser

# Apply migrations
python manage.py migrate

# Create superuser for admin access
python manage.py createsuperuser
# Enter: username=admin, [email protected], password=admin123

Step 7: Start Server and Test

# Start development server
python manage.py runserver

Step 8: Access and Test Features

Quick Test Checklist:

  1. Visit Hackathon List: http://127.0.0.1:8000/hackathons/

    • Should show empty list with "Create Hackathon" button
  2. Create Test Hackathon:

    • Click "Create Hackathon"
    • Fill in:
      • Name: "Test Hackathon 2024"
      • Description: "A test hackathon for plugin testing"
      • Start Date: Today's date
      • End Date: Tomorrow's date
    • Click "Create"
  3. Test Detail Page:

    • Click on your created hackathon
    • ** Charts should display**: You should see:
      • Pull Request Activity chart (bar chart)
      • Page Views sparkline (small chart)
    • ** Icons should display**: Font Awesome icons should be visible
  4. Test Admin Interface: http://127.0.0.1:8000/admin/

    • Login with superuser credentials
    • Navigate to "BLT_HACKATHON" → "Hackathons"
    • Should see your created hackathon

Success Indicators

  • Charts render properly (no console errors)
  • Font Awesome icons display
  • Responsive design works
  • Admin interface accessible
  • CRUD operations work (Create, Read, Update, Delete hackathons)

Troubleshooting

Charts Not Displaying?

  • Check browser console for JavaScript errors
  • Ensure Chart.js is loaded: <script src="https://cdn.jsdelivr.net/npm/chart.js"></script>
  • Ensure base template has {% block scripts %}{% endblock %}

Icons Not Displaying?

  • Check network tab for Font Awesome CSS load errors
  • Ensure Font Awesome CSS is in <head> section

500 Server Errors?

  • Check Django debug output
  • Ensure all migrations are applied: python manage.py migrate
  • Ensure blt_hackathon is in INSTALLED_APPS

Next Steps

  • Add GitHub repositories to track real pull requests
  • Configure sponsors and prizes
  • Customize the styling to match your project
  • Deploy to production

Total setup time: ~5 minutes

…templates

- Created initial plugin structure with __init__.py
- Implemented Hackathon, HackathonPrize, and HackathonSponsor models
- Developed forms for Hackathon, HackathonSponsor, and HackathonPrize
- Added views for listing, creating, and updating hackathons
- Implemented repository management features including refreshing data from GitHub
- Created base HTML template for consistent layout
- Defined URL patterns for hackathon-related views
… tag instead of inline template generation.
Copy link

@Pritz395 Pritz395 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very Minor issues but can cause crash:

1 The GitHubIssue model has no state field
2 Wrong field name (views.py line 781), using url= but model expects github_url=
3 Missing contributor relationship (views.py line 748), the Repository has no contributor field
4 Admin references non-existent fields (admin.py lines 42-55) , fieldsets include theme, location, is_online, etc. that don't exist in Hackathon model
5 Not a blocker but too many debug prints all over the repo, could probably fix this

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

Labels

None yet

Projects

None yet

2 participants