CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl-labs/django-best-practices

Django patterns -- custom user model, project structure, models, views, URL routing, select_related/prefetch_related, signals vs save(), middleware, settings splitting, custom managers, management commands

92

1.63x
Quality

87%

Does it follow best practices?

Impact

100%

1.63x

Average score across 5 eval scenarios

SecuritybySnyk

Passed

No known issues

Overview
Quality
Evals
Security
Files

criteria.jsonevals/scenario-2/

{
  "context": "Tests whether the agent proactively applies Django best practices when building an event booking system: custom user model, select_related for event listing and dashboard queries, TextChoices for event status, app_name, middleware ordering, save() override vs signals. The task describes business requirements without naming any patterns.",
  "type": "weighted_checklist",
  "checklist": [
    {
      "name": "Custom user model",
      "description": "The project defines a custom user model inheriting from AbstractUser and sets AUTH_USER_MODEL in settings. The agent was NOT asked for a custom user model.",
      "max_score": 12
    },
    {
      "name": "select_related on event listing",
      "description": "The events listing queryset uses select_related('organizer') or equivalent to load organizer names without N+1 queries. The agent was NOT asked about query optimization.",
      "max_score": 14
    },
    {
      "name": "select_related on dashboard bookings",
      "description": "The dashboard queryset for user bookings uses select_related on the event and/or organizer relation to avoid N+1 queries when showing event details.",
      "max_score": 12
    },
    {
      "name": "TextChoices for event status",
      "description": "The event status field uses a TextChoices (or IntegerChoices) class rather than raw string tuples for the upcoming/ongoing/completed/cancelled choices.",
      "max_score": 8
    },
    {
      "name": "app_name in urls.py",
      "description": "Each app's urls.py sets app_name for URL namespacing. The agent was NOT asked about URL namespacing.",
      "max_score": 10
    },
    {
      "name": "settings.AUTH_USER_MODEL for FK",
      "description": "ForeignKey fields to the user model use settings.AUTH_USER_MODEL, not a direct import of User.",
      "max_score": 10
    },
    {
      "name": "get_object_or_404 in detail view",
      "description": "The event detail view uses get_object_or_404 (or equivalent CBV pattern) rather than bare .get().",
      "max_score": 8
    },
    {
      "name": "Correct middleware ordering",
      "description": "MIDDLEWARE list has SecurityMiddleware first and SessionMiddleware before AuthenticationMiddleware. The agent was NOT asked about middleware ordering.",
      "max_score": 8
    },
    {
      "name": "related_name on ForeignKey fields",
      "description": "ForeignKey fields (organizer, attendee, booking) include related_name.",
      "max_score": 6
    },
    {
      "name": "db_index on status and date fields",
      "description": "The event status field and/or date field has db_index=True for efficient filtering and sorting.",
      "max_score": 6
    },
    {
      "name": "get_absolute_url on Event model",
      "description": "The Event model defines get_absolute_url() using reverse() with a namespaced URL.",
      "max_score": 6
    }
  ]
}

evals

tile.json