Skip to content

Latest commit

 

History

History
41 lines (34 loc) · 1.6 KB

File metadata and controls

41 lines (34 loc) · 1.6 KB

Agent Guidelines

Build & Test Commands

# Install dependencies
pip install -r requirements.txt

# Run development server
python manage.py runserver

# Run migrations
python manage.py makemigrations
python manage.py migrate

# Run all tests
python manage.py test

# Run specific test app/file/class/method
python manage.py test dashboard
python manage.py test dashboard.tests
python manage.py test dashboard.tests.TestClassName
python manage.py test dashboard.tests.TestClassName.test_method_name

# Collect static files (for production)
python manage.py collectstatic --noinput

Code Style

  • Python version: 3.12+ (as per Dockerfile)
  • Type hints: Use for all function parameters and return values
  • Imports: Group in order: stdlib, django, third-party, local (blank line between groups)
  • Naming: snake_case for functions/variables, PascalCase for classes
  • Line length: 88 characters (Black compatible)
  • Docstrings: Required for models explaining fields and relationships
  • Error handling: Use try/except with specific error types, include meaningful messages
  • Views: Use class-based views (CBVs) with LoginRequiredMixin for protected views
  • View error handling: Wrap API views in try/except blocks with proper JsonResponse errors
  • Templates: Keep logic minimal - complex operations belong in views/models
  • URLs: Use path('route/', views.my_view, name='view_name') pattern with named URLs
  • Models: Include str methods and use @property decorators for computed fields
  • Static files: Store in static/ directory, reference using {% static %} template tag