Documentation navigation

Adding a Feature

Add a feature to a generated Djass project by choosing one user outcome, mapping it to the repository's existing apps, and writing acceptance tests before widening the scope. The private-upload example below turns that process into a concrete build brief. It is work you implement, not an upload feature that Djass generates for you.

1) Start with one vertical slice

Define the smallest shippable slice that includes:

  • domain logic,
  • user/API surface,
  • and success/failure states.

Avoid starting with broad refactors.

2) Place code in the right app

  • Domain models/services → apps/core
  • API routers/schemas → apps/api
  • Product pages/templates → apps/pages + frontend/templates
  • Async work → apps/core/tasks.py queued through Django Q2

3) Implement in this order

  1. Model changes and migrations
  2. Service/business logic
  3. API/view layer
  4. Template/UI updates
  5. Background task wiring (if needed)
  6. Tests and regression checks

4) Define authorization before release

For a customer-owned feature, require both a signed-in user and permission to act on the requested record. Authentication alone does not establish ownership. Write the rule before asking an agent to build the view: an account can list, read, change, and delete only its own records, unless you explicitly design sharing. Apply it to each operation, not just the page that displays a button.

Start from the generated app, not the hosted generator

In the bundled starter checked on October 24, 2026, apps/core/models.py defines a Profile linked to Django's built-in User. The generated UserSettingsView.get_object() in apps/core/views.py selects the profile using self.request.user. That is a useful self-service pattern, not a workspace membership or tenant-role system. A profile's existence or paid subscription state does not establish access to another customer's records.

The hosted Djass application's generation-project model is separate from this baseline. Do not assume downloading a repository gives your product that model or its access rules. Review the repository map and user-model guide before adding relationships.

Scope the lookup, then allow the operation

For the proposed CustomerProject model in the user-model guide, this illustrative Django 6.0 lookup combines the record ID with its owner:

from django.shortcuts import get_object_or_404


def owned_project_or_404(user, project_id):
    return get_object_or_404(
        CustomerProject,
        pk=project_id,
        owner=user,
    )

Import CustomerProject from the app where you implement it; it is not a bundled starter model. Call this helper only after authenticating the requester. It illustrates Django 6.0's filtered get_object_or_404() lookup, not a complete view, write policy, or tenancy framework. Filter list queries by the same owner. On create, set ownership on the server; exclude ownership from ordinary editable form/API fields. Keep CSRF protection for session-based writes.

For action privileges, Django's permissions system can complement ownership. Do not replace an owner filter with a model-wide change permission. Django 6.0's default ModelBackend does not implement object-specific permission lookup. Passing an object to has_perm() is not an implementation of your ownership policy.

Give the agent a denial contract

Add this to the feature brief:

Use two ordinary accounts, A and B, with separate owned records. Prove A can complete the intended operation on A's record and cannot list, read, update, delete, export, or download B's record by changing an ID or URL. Try ownership fields in submitted form/API data; reject or ignore them without transferring ownership. Cover anonymous requests and any background-job entrypoint. Report which paths were exercised; a hidden UI control is not a denial check.

If the feature needs shared workspaces, stop treating owner=user as the final design. Define membership, role, resource scope, and revocation behavior first; then test the same user with different roles in two workspaces. Those models and rules are work you add, not an option that Djass silently enables. Keep rollout flags separate from access decisions.

For the first shared-workspace slice, follow the tested invitation acceptance flow. It separates new-account verification from joining a workspace and checks that a consumed invitation cannot restore revoked membership. Issuance, delivery, and workspace permissions still need your implementation.

Done looks like: the allowed action works, rejected requests reveal no other customer's data, and rejected writes leave the database unchanged. These are acceptance requirements, not a claim that the generated app or your finished feature has passed a security assessment.

5) Keep operations safe

If customers need evidence of a sensitive action, use the first-audit build contract to specify success, denial, rollback, privacy, and access checks. The hosted generator's API audit table is not included in your generated app.

If the first customer job is a downloadable report, use the private CSV export build brief to define request, worker, access, expiry, and download acceptance checks. It is an alternative worked example, not a report feature generated by Djass.

If the feature changes background processing or account-access flows:

  • add explicit logs for traceability,
  • persist failure reasons users can understand,
  • keep retry paths available (manual or automated).

For incremental production release, separate authorization from rollout and write the rollback contract before enabling the new path. Use the Django feature-flags production guide for safe defaults, background-job admission, evidence, tests, and cleanup.

6) Ship with docs in the same PR

If behavior, architecture, or setup changed, update docs in the same PR.

At minimum, update:

  • the relevant docs page,
  • any setup instructions affected,
  • and examples/commands users rely on.

Worked example: add a private attachment

Start with one job: a signed-in customer uploads one attachment, sees its processing status, and downloads it only after validation succeeds. Leave shared folders, public links, bulk uploads, and resumable transfers out of the first slice. Choose the permitted file types, maximum size, retention period, and validation service before implementation; those are product decisions, not defaults supplied by this example.

Check the generated baseline first

If you do not have a repository yet, follow the project-generation workflow and review the available options. Enable Use S3 only if you intend to use object storage. Generation requires the appropriate Djass access.

Before changing settings, follow the generated-media checklist to confirm the actual bucket, region, endpoint, and access policy. Setting a variable in .env has no effect unless the downloaded app reads it.

The bundled starter inspected on October 30, 2026 provides storage settings, not an upload form, scanner, or private-download feature. Its S3 media baseline uses public-read and unsigned URLs. Do not use that baseline unchanged for private attachments. Choose a private bucket or prefix, remove the public ACL, and verify anonymous reads are denied before accepting customer files. The S3 access guide explains policy and signed-URL configuration; changing URL signing alone does not make an object private.

Turn the outcome into a build brief

Give your coding agent the following task in the generated repository, not in the hosted Djass application. This is a proposed feature contract, not ready-to-run code:

Read this repository's agent instructions and existing account, storage, and background-job conventions. Build one owner-scoped attachment workflow. First report the chosen size/type limits and storage policy; flag any missing decision before accepting uploads. Persist an owner, a server-generated object key, and processing state. Keep unvalidated bytes private. Add an authenticated upload form, an owner-only status view, and a download endpoint that checks ownership and readiness on every request. Queue validation after the database commit and make retries idempotent. Define cleanup for rejected files and interrupted work. Show the tests and remaining deployment checks before calling the feature complete. Never put credentials or signed URLs in logs.

Keep the model and state transitions in apps/core; add the user-facing view and template using the repository's existing page conventions. Use apps/core/tasks.py for queued work. Add an API surface only if the first customer workflow needs one. For the detailed state machine, finalization rules, and failure cases, use the upload pipeline guide rather than inventing a second implementation contract.

Prove the user outcome

Acceptance tests should demonstrate that:

  • one valid upload creates one owned record and progresses to a downloadable state;
  • another account cannot inspect its status or obtain its download;
  • an anonymous request to the stored object is denied;
  • a disallowed file or failed validation never becomes downloadable;
  • a retried task does not create duplicate accepted files;
  • interrupted processing and deletion can be reconciled safely.

Use the Django 6.0 file-upload reference for form binding and upload-handler behavior, and the OWASP file-upload checklist for defense-in-depth controls. Run provider and proxy checks separately from unit tests: a mocked storage backend cannot prove the production access policy or request-size limit. This brief does not certify an implementation as secure.

Definition of done

A feature is done when:

  • users can complete the intended job,
  • unhappy paths are handled,
  • docs are updated,
  • and runtime/config impact is understood.