django-web-framework — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited django-web-framework (Agent Skill) and scored it 91/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 1 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 1 flagged
The text {match} is the classic direct prompt-injection phrasing. Placed in a skill body that the agent reads as trusted instructions, it tries to make the agent abandon its prior rules and follow whatever comes next — a full system-prompt override.
ignore/disregard/forget … previous instructions sentence.Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Django is a high-level Python web framework that follows the Model-View-Template (MVT) pattern.
# Create virtual environment
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
# Install Django
pip install django
# Create new project
django-admin startproject myproject
cd myproject
# Create new app
python manage.py startapp myappDefine your database schema using Django models:
# myapp/models.py
from django.db import models
class Blog(models.Model):
title = models.CharField(max_length=200)
content = models.TextField()
author = models.CharField(max_length=100)
created_at = models.DateTimeField(auto_now_add=True)
updated_at = models.DateTimeField(auto_now=True)
published = models.BooleanField(default=False)
class Meta:
ordering = ['-created_at']
def __str__(self):
return self.titleTrack database schema changes:
# Create migrations
python manage.py makemigrations
# Apply migrations
python manage.py migrate
# Show migration plan
python manage.py showmigrationsDjango supports class-based and function-based views:
# myapp/views.py
from django.shortcuts import render, get_object_or_404
from django.http import JsonResponse
from .models import Blog
def blog_list(request):
blogs = Blog.objects.filter(published=True)
return render(request, 'blog/list.html', {'blogs': blogs})
def blog_detail(request, pk):
blog = get_object_or_404(Blog, pk=pk)
return render(request, 'blog/detail.html', {'blog': blog})from django.views import View
from django.views.generic import ListView, DetailView
from .models import Blog
class BlogListView(ListView):
model = Blog
template_name = 'blog/list.html'
context_object_name = 'blogs'
paginate_by = 10
def get_queryset(self):
return Blog.objects.filter(published=True)
class BlogDetailView(DetailView):
model = Blog
template_name = 'blog/detail.html'Map URLs to views:
# myapp/urls.py
from django.urls import path
from . import views
urlpatterns = [
path('blogs/', views.BlogListView.as_view(), name='blog-list'),
path('blogs/<int:pk>/', views.BlogDetailView.as_view(), name='blog-detail'),
]
# myproject/urls.py
from django.contrib import admin
from django.urls import path, include
urlpatterns = [
path('admin/', admin.site.urls),
path('api/', include('myapp.urls')),
]Built-in user authentication:
from django.contrib.auth.decorators import login_required
from django.contrib.auth.views import LoginView, LogoutView
from django.contrib.auth.models import User
# Create user
user = User.objects.create_user(username='john', password='secret123')
# Protect views
@login_required
def protected_view(request):
return render(request, 'protected.html')
# In templates
{% if user.is_authenticated %}
Welcome, {{ user.username }}!
{% else %}
<a href="{% url 'login' %}">Login</a>
{% endif %}Efficient database queries:
# Basic queries
blogs = Blog.objects.all()
blog = Blog.objects.get(pk=1)
blogs = Blog.objects.filter(published=True)
blogs = Blog.objects.exclude(author='Anonymous')
# Aggregations
from django.db.models import Count, Q
count = Blog.objects.filter(published=True).count()
recent = Blog.objects.filter(created_at__gte='2025-01-01')
or_query = Blog.objects.filter(Q(published=True) | Q(author='Admin'))
# Relationships
author_blogs = Blog.objects.filter(author__isnull=False)
blog.related_set.all()
# Optimization
blogs = Blog.objects.select_related('author').all()
blogs = Blog.objects.prefetch_related('comments').all()Handle form validation:
from django import forms
from .models import Blog
class BlogForm(forms.ModelForm):
class Meta:
model = Blog
fields = ['title', 'content', 'published']
widgets = {
'content': forms.Textarea(attrs={'rows': 10}),
}
# In view
def create_blog(request):
if request.method == 'POST':
form = BlogForm(request.POST)
if form.is_valid():
blog = form.save()
return redirect('blog-detail', pk=blog.pk)
else:
form = BlogForm()
return render(request, 'blog/form.html', {'form': form})Write tests for your Django app:
# myapp/tests.py
from django.test import TestCase, Client
from .models import Blog
class BlogModelTest(TestCase):
def setUp(self):
self.blog = Blog.objects.create(title='Test', content='Content', author='Test')
def test_blog_str(self):
self.assertEqual(str(self.blog), 'Test')
class BlogViewTest(TestCase):
def setUp(self):
self.client = Client()
self.blog = Blog.objects.create(title='Test', published=True)
def test_blog_list_view(self):
response = self.client.get('/api/blogs/')
self.assertEqual(response.status_code, 200)Run tests:
python manage.py test
python manage.py test myapp.tests.BlogModelTest
python manage.py test --verbosity=2Auto-generated admin interface:
# myapp/admin.py
from django.contrib import admin
from .models import Blog
@admin.register(Blog)
class BlogAdmin(admin.ModelAdmin):
list_display = ('title', 'author', 'published', 'created_at')
list_filter = ('published', 'created_at')
search_fields = ('title', 'content')
readonly_fields = ('created_at', 'updated_at')Access at: http://localhost:8000/admin
Process requests and responses:
# myapp/middleware.py
class TimezoneMiddleware:
def __init__(self, get_response):
self.get_response = get_response
def __call__(self, request):
timezone.activate(request.user.timezone)
response = self.get_response(request)
return response
# Add to MIDDLEWARE in settings.py
MIDDLEWARE = [
'myapp.middleware.TimezoneMiddleware',
]Handle CSS, JavaScript, and uploads:
# settings.py
STATIC_URL = '/static/'
STATIC_ROOT = BASE_DIR / 'staticfiles'
MEDIA_URL = '/media/'
MEDIA_ROOT = BASE_DIR / 'media'
# urls.py
from django.conf import settings
from django.conf.urls.static import static
urlpatterns = [...]
if settings.DEBUG:
urlpatterns += static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)Production deployment checklist:
# settings.py
DEBUG = False
ALLOWED_HOSTS = ['yourdomain.com', 'www.yourdomain.com']
SECRET_KEY = os.getenv('SECRET_KEY')
# Use environment-based settings
if os.getenv('ENVIRONMENT') == 'production':
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.postgresql',
'NAME': os.getenv('DB_NAME'),
'USER': os.getenv('DB_USER'),
'PASSWORD': os.getenv('DB_PASSWORD'),
'HOST': os.getenv('DB_HOST'),
}
}
# Collect static files
python manage.py collectstatic --noinput
# Run migrations
python manage.py migrate
# Use gunicorn
pip install gunicorn
gunicorn myproject.wsgi:applicationSource: Django Official Documentation (https://docs.djangoproject.com)
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.