ACM Editorial · 2026-11-28 · 1 min read

Represent clients, invoices and invoice lines as separate entities with clear foreign keys.

Model the relationships

Represent clients, invoices and invoice lines as separate entities with clear foreign keys. Choose deletion behaviour deliberately: a financial record should not disappear when a contact is removed. Add uniqueness constraints for business identifiers where required.

Use forms and validation

Model forms can reduce duplicate input handling, but workflow rules still require explicit validation. Check that an invoice belongs to an eligible client and that a payment cannot exceed the remaining amount. Avoid trusting hidden form values.

Enforce object-level authorisation

A logged-in employee should not automatically have access to all salary or client records. Filter querysets using the authenticated user and role, and verify access again for downloads and update actions.

Prepare production settings

Keep secret keys outside version control, turn off debug mode, configure allowed hosts and use secure cookies over HTTPS. Run migrations on staging first and test backups, static files and private media permissions.

Further reading

https://docs.djangoproject.com/