Overview
TheArtist model represents a tattoo artist in the studio with commission rate configuration and relationships to sessions and portfolio items.
Model Definition
Fields
Primary Key
Unique identifier for the artist (auto-increment)
Artist Information
Artist’s name or stage nameLength: Maximum 120 charactersIndexed: Yes, for fast lookups
Commission rate for the artist (0.0 to 1.0)Default: 0.50 (50% commission)Example: 0.50 means the artist receives 50% of session revenue
Whether the artist is currently active in the studio
Relationships
List of all tattoo sessions assigned to this artistRelationship: One-to-Many with TattooSessionBack Populates:
artist on TattooSession modelList of portfolio items (images) associated with this artistRelationship: One-to-Many with PortfolioItemCascade:
all, delete-orphan - portfolio items are deleted when artist is deletedBack Populates: artist on PortfolioItem modelList of clients who have this artist as their preferred artistRelationship: Backref from Client.preferred_artistForeign Key: Client.preferred_artist_id → Artist.id
Database Schema
Usage Examples
Create a New Artist
Query Artist with Sessions
Get Active Artists
Update Commission Rate
Commission Rate Details
Therate_commission field determines how revenue is split between the artist and the studio:
- Value Range: 0.0 to 1.0 (representing 0% to 100%)
- Default: 0.50 (50/50 split)
- Common Values:
- 0.40 = 40% to artist, 60% to studio
- 0.50 = 50% to artist, 50% to studio
- 0.60 = 60% to artist, 40% to studio
TattooSession.commission_override.
Notes
- Artists can be deactivated using the
activeflag without deleting their records - The
namefield is indexed for fast searches and lookups - Commission rates are stored as decimals (0.50 = 50%)
- Deleting an artist will cascade delete all their portfolio items
- Sessions have
RESTRICTon delete, preventing artist deletion if they have sessions - Location in codebase:
data/models/artist.py:5