Cursor Rules Template: Django Admissions Platform
Cursor Rules Template for Django-based university admissions platform with scores, preferences, rankings, and PDF reports.
Target User
Backend engineers and AI-assisted developers building university admissions platforms
Use Cases
- Generate Django backend skeleton for admissions platform
- Define models and data flow for scores, preferences, and rankings
- Produce PDF reports for admitted cohorts
- Enforce safe AI-assisted development patterns with Cursor AI
Markdown Template
Cursor Rules Template: Django Admissions Platform
framework: django
language: python
version: '3.11-3.12'
database: postgresql
pdf_engine: reportlab
roles:
framework_role_context: Build a Django backend for university admissions with models for Applicant, Score, Preference, Ranking, and PDFReport
cursor_role: Senior Backend Engineer and data model designer for scoring and ranking pipeline
style:
code_style: pep8
linting: true
architecture:
directories:
- admissions/
- admissions/app/
- admissions/models.py
- admissions/views.py
- admissions/serializers.py
- admissions/tests/
- admissions/pdfs/
- admissions/services/
security:
authentication: jwt
authorization: DRF_permissions
tls: true
csrf: strict
secrets: env
database:
orm: django_orm
patterns:
- atomic_transactions
- select_related_and_prefetch
migrations: auto
testing:
pytest: true
lint: true
ci: true
antiPatterns:
prohibitedActions:
- raw_sql_without_params
- string_concatenation_in_queries
- secret_in_code
- writing_pdf_generation_in_http_request_thread
doNot:
- use non django orm wrappers
- embed business logic in views
- skip tests for scoring algorithmsOverview
The Cursor rules configuration here documents the Django+PostgreSQL stack for a university admissions recommendation platform. It covers scoring, applicant preferences, ranking generation, and PDF report generation. The rules guide Cursor AI to produce safe, maintainable backend code and deterministic ranking logic while enabling repeatable deployments.
When to Use These Cursor Rules
- When building a Django backend that handles Applicant, Score, Preference, Ranking, and PDFReport entities
- When you need robust data modeling with transactionally safe scoring and ranking pipelines
- When integrating PDF reports generated via ReportLab for admissions decisions
- When enforcing security, testing, and CI/CD practices for production readiness
Copyable .cursorrules Configuration
The following block is a copyable Cursor rules configuration for a Django based admissions stack. Paste it at project root as .cursorrules and adapt paths and environment variables as needed.
framework: django
language: python
version: '3.11-3.12'
database: postgresql
pdf_engine: reportlab
roles:
framework_role_context: Build a Django backend for university admissions with models for Applicant, Score, Preference, Ranking, and PDFReport
cursor_role: Senior Backend Engineer and data model designer for scoring and ranking pipeline
style:
code_style: pep8
linting: true
architecture:
directories:
- admissions/
- admissions/app/
- admissions/models.py
- admissions/views.py
- admissions/serializers.py
- admissions/tests/
- admissions/pdfs/
- admissions/services/
security:
authentication: jwt
authorization: DRF_permissions
tls: true
csrf: strict
secrets: env
database:
orm: django_orm
patterns:
- atomic_transactions
- select_related_and_prefetch
migrations: auto
testing:
pytest: true
lint: true
ci: true
antiPatterns:
prohibitedActions:
- raw_sql_without_params
- string_concatenation_in_queries
- secret_in_code
- writing_pdf_generation_in_http_request_thread
doNot:
- use non django orm wrappers
- embed business logic in views
- skip tests for scoring algorithms
Recommended Project Structure
Stack-specific directory layout for Django with PostgreSQL and PDF reports.
admissions/
manage.py
admissions/
__init__.py
asgi.py
wsgi.py
settings.py
urls.py
apps.py
models.py
views.py
serializers.py
tests/
migrations/
templates/
services/
pdfs/
requirements.txt
Dockerfile
docker-compose.yml
celery/
__init__.py
apps.py
tasks.py
Core Engineering Principles
- Clear separation of concerns: models, views, serializers, and services.
- Deterministic ranking: use Django ORM with window functions to ensure stable rankings.
- Safe Cursor AI usage: guardrails, linting, and strict permissions.
- Test-driven development: pytest-django, factories, and CI validation.
- Observability: structured logs and metrics for admission decisions and PDF generation.
Code Construction Rules
- Prefer Django REST Framework ViewSets and routers for API surfaces.
- Model naming: Applicant, Score, Preference, Ranking, PDFReport; ensure foreign keys and related names are explicit.
- Background tasks: use Celery for ranking computation and PDF generation.
- Database operations: wrap multi-step scoring in atomic transactions.
- PDF generation: generate via ReportLab and stream to client; store in media as PDFReport records.
- Do not use raw SQL without parameters; avoid string interpolation in queries.
- Do not mix business logic in views; create services modules and serializers to encapsulate logic.
Security and Production Rules
- Use TLS/HTTPS and secure cookies; enforce DRF permissions on all sensitive endpoints.
- Store secrets in environment variables or a secrets manager; never hard-code credentials.
- Enable CSRF protection for UI endpoints; disable for internal API calls with proper origin checks.
- Rate-limit API requests and monitor for anomalous patterns.
- Validate all inputs and enforce strict access controls for PDF reports.
Testing Checklist
- Unit tests for scoring algorithms and ranking logic
- Integration tests for create applicant, add scores, compute rankings, and generate PDFs
- End-to-end tests for admissions workflow
- CI checks for linting, type checks, and migrations
Common Mistakes to Avoid
- Isolating PDF generation logic without streaming or buffering considerations
- Overloading views with business logic
- Skipping tests for core scoring rules
- Neglecting security and secrets management
Related Cursor rules templates
Explore adjacent Cursor rules templates for similar stacks, workflows, and production constraints.
- Cursor Rules Template: Construction Project Management Stack
- Cursor Rules Template for Django Bootcamp Management Platform
- Cursor Rules Template: Django Subscription Box Platform
- Cursor Rules Template: Real Estate CRM with Leads, Listings, Tours, Follow-ups, Documents and Agent Dashboards
FAQ
What is the purpose of this Cursor Rules Template?
It provides a Django-based architecture and Cursor AI guardrails for an admissions platform with scores, preferences, rankings, and PDF reports, ensuring consistent engineering discipline.
Which stack does this template cover?
Django with Python, PostgreSQL, Django REST Framework, JWT authentication, PDF generation via ReportLab, and Celery for background tasks.
How do I apply this in my project?
Copy the code block from the Copyable .cursorrules Configuration section into your project root as .cursorrules and adapt paths and environment settings.
How are PDFs generated and served?
PDFs are generated using ReportLab, produced by a background task, and served via streaming responses or as downloadable files, with proper memory management and PDFReport linking.
What are the security considerations?
Use TLS, secure authentication and permissions, avoid hard-coded secrets, enable CSRF for UI endpoints, and validate all inputs.